A simple backend for managing posts or notes with user authentication using JWT and MongoDB Atlas.
Includes registration, login, and protected routes.
💡 Future goals:
- Multi-role access control (admin, super-admin, user)
- API documentation via Swagger
- Docker setup for containerized deployment
- Node.js + Express.js
- MongoDB Atlas (Mongoose ODM)
- JWT (jsonwebtoken) for authentication
- bcryptjs for password hashing
- dotenv for environment variables
- Jest or Vitest (for testing)
- GitHub Actions (for CI)
git clone https://github.com/bhowmik94/NodeMongo.git
cd NodeMongo
npm installCreate a .env file in the root directory with the following keys:
MONGO_URI="your-mongo-connection-string-here"MONGO_URI=mongodb+srv://username:password@clustername.mongodb.net/testdb
JWT_SECRET=changeme123
PORT=5000Start the development server with:
Start the development server with:Server runs at:
http://localhost:5000Run tests with:
npm testThis project includes a GitHub Actions workflow (.github/workflows/ci.yml) that automatically:
-
Installs dependencies
-
Runs backend tests
-
Verifies code quality
Pull requests are welcome! If you fork the repo:
-
Duplicate .env.example → .env
-
Add your MongoDB credentials
-
Run locally and test
-
Submit a PR
✅ JWT Authentication ✅ CRUD for posts ✅ CI with GitHub Actions ✅ MongoDB Atlas Ready ✅ Future-ready (Admin roles, Swagger, Docker)