Express and MongoDB backend for Boolforge / Digital Logics Studio. It provides health checks and JWT-based authentication endpoints for the frontend application.
- Node.js
- Express
- MongoDB Atlas
- Mongoose
- JWT
- bcryptjs
DigitalLogicsStudio-Backend/
├── src/
│ ├── config/
│ ├── controllers/
│ ├── middleware/
│ ├── models/
│ ├── routes/
│ ├── utils/
│ └── app.js
├── .env.example
├── server.js
├── package.json
└── README.md
Create a local .env file from .env.example.
PORT=5000
NODE_ENV=development
CLIENT_URL=http://localhost:3000
MONGO_URI=your-mongodb-connection-string
JWT_SECRET=replace-with-a-long-random-secret
JWT_EXPIRES_IN=7d
COOKIE_EXPIRES_DAYS=7Install dependencies:
npm installRun in development:
npm run devRun in production mode:
npm startGET /- backend status messageGET /api/health- basic health checkPOST /api/auth/register- create accountPOST /api/auth/login- log inPOST /api/auth/logout- clear auth cookieGET /api/auth/me- fetch current logged-in user
- Passwords are hashed with
bcryptjs - JWTs are issued by the backend
- Tokens are stored in an HTTP-only cookie
- CORS is configured to allow requests from
CLIENT_URL
.envfiles are ignored;.env.exampleremains trackedpackage-lock.jsonis tracked and should stay committed