A full-featured Trello clone backend built with Node.js, Express, and MongoDB. This RESTful API provides comprehensive board management, real-time collaboration, and user authentication.
-
π Authentication & Authorization
- JWT-based authentication
- User registration with email verification
- Secure password handling
- Protected routes with middleware
-
π Board Management
- Create, read, update, delete boards
- Board ownership and permissions
- Invite users to boards
- Real-time board updates via WebSocket
-
π Column & Card System
- Flexible column management
- Drag-and-drop card organization
- Card descriptions and activities
- Card attachments
-
π₯ User Collaboration
- User invitations system
- Board member management
- Real-time notifications
-
π File Management
- Image upload support (Cloudinary)
- Avatar management
- Card attachments
-
βοΈ Email Services
- Email verification
- Invitation emails
- Powered by Brevo
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Validation: Express Validator / Joi
- File Upload: Multer
- Cloud Storage: Cloudinary
- Email Service: Brevo (formerly Sendinblue)
- WebSocket: Socket.io
- CORS: Express CORS middleware
trello-api/
βββ src/
β βββ config/ # Configuration files
β β βββ cors.js
β β βββ environment.js
β β βββ mongodb.js
β βββ controllers/ # Request handlers
β β βββ boardController.js
β β βββ cardController.js
β β βββ columnController.js
β β βββ invitationController.js
β β βββ userController.js
β βββ middlewares/ # Custom middleware
β β βββ authMiddleware.js
β β βββ erorHandlingMiddleware.js
β β βββ multerUploadMiddleware.js
β βββ models/ # Database models
β β βββ boardModel.js
β β βββ cardModel.js
β β βββ columnModel.js
β β βββ invitationModel.js
β β βββ userModel.js
β βββ providers/ # Third-party service integrations
β β βββ BrevoProvider.js
β β βββ CloudinaryProvider.js
β β βββ JwtProvider.js
β βββ routes/ # API routes
β β βββ v1/
β β βββ boardRoute.js
β β βββ cardRoute.js
β β βββ columnRoute.js
β β βββ invitationRoute.js
β β βββ userRoute.js
β β βββ index.js
β βββ services/ # Business logic
β β βββ boardService.js
β β βββ cardService.js
β β βββ columnService.js
β β βββ invitationService.js
β β βββ userService.js
β βββ sockets/ # WebSocket handlers
β β βββ inviteUserToBoardSocket.js
β βββ utils/ # Utility functions
β β βββ algorithms.js
β β βββ ApiError.js
β β βββ constants.js
β β βββ formatters.js
β β βββ sorts.js
β β βββ validators.js
β βββ validations/ # Request validation schemas
β β βββ boardValidation.js
β β βββ cardValidation.js
β β βββ columnValidation.js
β β βββ invitationValidation.js
β β βββ userValidation.js
β βββ server.js # Application entry point
βββ .env.example
βββ .eslintrc.cjs
βββ .babelrc
βββ jsconfig.json
βββ package.json
- Node.js (v16 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
-
Clone the repository
git clone https://github.com/Justinianus2001/trello-api.git cd trello-api -
Install dependencies
npm install
-
Set up environment variables
Copy
.env.exampleto.envand fill in your credentials:cp .env.example .env
Required environment variables:
# Server Configuration LOCAL_DEV_APP_HOST=localhost LOCAL_DEV_APP_PORT=8017 # Build Mode BUILD_MODE=dev # Database MONGODB_URI=your_mongodb_connection_string DATABASE_NAME=your_database_name # JWT Secret JWT_SECRET=your_jwt_secret_key # Cloudinary (for file uploads) CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret # Brevo (for emails) BREVO_API_KEY=your_brevo_api_key BREVO_SENDER_EMAIL=your_sender_email BREVO_SENDER_NAME=Your_App_Name # Client URL (for CORS and email links) CLIENT_URL=http://localhost:5173
-
Start the development server
npm run dev
The API will be available at
http://localhost:8017
npm run build
npm starthttp://localhost:8017/v1
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /users/register |
Register a new user | No |
| POST | /users/login |
Login user | No |
| GET | /users/verify/:token |
Verify email | No |
| GET | /users/me |
Get current user | Yes |
| PUT | /users/update |
Update user profile | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /boards |
Get all user boards | Yes |
| POST | /boards |
Create new board | Yes |
| GET | /boards/:id |
Get board details | Yes |
| PUT | /boards/:id |
Update board | Yes |
| DELETE | /boards/:id |
Delete board | Yes |
| POST | /boards/:id/invite |
Invite user to board | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /columns |
Create column | Yes |
| PUT | /columns/:id |
Update column | Yes |
| DELETE | /columns/:id |
Delete column | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /cards |
Create card | Yes |
| PUT | /cards/:id |
Update card | Yes |
| DELETE | /cards/:id |
Delete card | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /invitations |
Get user invitations | Yes |
| POST | /invitations/:id/accept |
Accept invitation | Yes |
| POST | /invitations/:id/decline |
Decline invitation | Yes |
This API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:
Authorization: Bearer <your_jwt_token>
npm testThis project uses ESLint for code linting. Run the linter:
npm run lint- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Hoang Le Ngoc - @Justinianus2001
- Inspired by Trello
- Built as a learning project for full-stack development
For questions or support, please open an issue or contact: lengochoang681@gmail.com
Frontend Repository: trello-web