CampusConnect is a backend application designed to manage university operations, including student and user management. The application is built with Node.js, Express, and TypeScript, providing a robust and scalable architecture.
- Features
- Project Structure
- Installation
- Usage
- API Documentation
- Configuration
- Error Handling
- Deployment
- Contributing
- License
- User management (registration, authentication, authorization)
- Student management (CRUD operations)
- Centralized error handling
- TypeScript for type safety
- Configurable via environment variables
- Ready for deployment on Vercel
src/
├── app.ts
├── server.ts
├── app/
│ ├── config/
│ │ └── index.ts
│ ├── middlewares/
│ │ ├── globalErrorHandler.ts
│ │ └── notFoundRoute.ts
│ ├── modules/
│ │ ├── student/
│ │ │ ├── student.controller.ts
│ │ │ ├── student.interface.ts
│ │ │ ├── student.model.ts
│ │ │ ├── student.route.ts
│ │ │ ├── student.service.ts
│ │ │ └── student.validation.ts
│ │ └── user/
│ │ ├── user.controller.ts
│ │ ├── user.interface.ts
│ │ ├── user.model.ts
│ │ ├── user.router.ts
│ │ ├── user.service.ts
│ │ └── user.validation.ts
│ └── routes/
│ └── index.ts
│ └── utils/
│ └── sendResponse.ts
package.json
tsconfig.json
vercel.json
-
Clone the repository:
git clone https://github.com/rirefat/campusConnect-backend.git cd campusConnect-backend
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the necessary environment variables (refer tosrc/app/config/index.ts
for required variables).
-
Start the development server:
npm run dev
-
Build the project:
npm run build
-
Start the production server:
npm start
POST /api/users
- Register a new userPOST /api/users/login
- User login
GET /api/students
- Get all studentsPOST /api/students
- Create a new studentGET /api/students/:id
- Get a student by IDPUT /api/students/:id
- Update a student by IDDELETE /api/students/:id
- Delete a student by ID
The application can be configured via environment variables. The following variables are required:
PORT
: Port on which the server runsDATABASE_URL
: Database connection string
Global error handling is implemented in src/app/middlewares/globalErrorHandler.ts
. 404 errors are handled by src/app/middlewares/notFoundRoute.ts
.
The application is configured for deployment on Vercel. Ensure that vercel.json
is properly set up and environment variables are configured in the Vercel dashboard.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License.