Full-stack Angular + Node.js + MongoDB project for managing users, events, and participations.
backend/— Express API with MongoDB, JWT auth, and seed/migration scriptevent-app/— Angular frontend
- Node.js 18+ and npm
- MongoDB running locally, or a valid MongoDB connection string
The backend uses the MongoDB database named emploi-angular by default.
Backend .env file:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/emploi-angular
JWT_SECRET=ahlaThis clears the collections and inserts mock data.
cd /home/jess/ssd/dev/emploi-angular/backend
npm run migrateMock login created by the seed:
- Email:
ouneliadem@gmail.com - Password:
123456
cd /home/jess/ssd/dev/emploi-angular/backend
npm install
npm startBackend URL:
http://localhost:5000- API base path:
http://localhost:5000/api
cd /home/jess/ssd/dev/emploi-angular/event-app
npm install
npm startAngular app URL:
http://localhost:4200
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/me
GET /api/usersGET /api/users/:idPOST /api/usersPUT /api/users/:idDELETE /api/users/:id
GET /api/eventsPOST /api/eventsPUT /api/events/:idDELETE /api/events/:id
GET /api/participationsPOST /api/participationsDELETE /api/participations/:id
- The frontend stores the JWT token after login/register.
- An Angular HTTP interceptor sends the token automatically in the
Authorizationheader. - Protected routes redirect logged-in users away from
/auth/loginand/auth/register. - Protected app routes redirect unauthenticated users to
/auth/login.
Backend:
npm run migrate
npm start
npm run devFrontend:
npm start
npm run build
npm test- The seed script is rerunnable and resets the data before inserting mock records.
- If MongoDB is remote, update
MONGODB_URIinbackend/.envbefore running the migration.