Skip to content

Repository files navigation

🧠 Project Manager Backend

A robust and scalable backend API for a project management platform with planned real-time AI chatbot support. Built with Node.js, TypeScript, Apollo Server (GraphQL), Prisma ORM, MongoDB, DataLoader for batching, and JWT + Google OAuth authentication.


🚀 Features

  • 🔐 User registration, login, and authentication (JWT + Google OAuth2)
  • 📊 Project & task management with full CRUD via GraphQL
  • 🧩 Efficient query resolution with DataLoader (batching & caching)
  • 📈 Dashboard insights
  • 📬 Password reset & change flow
  • 🔒 Input validation, secure headers, CORS, and error handling
  • 🧪 Unit & integration tests with Jest + Supertest

🛠 Tech Stack

  • Language: TypeScript
  • Runtime: Node.js
  • Framework: Apollo Server (GraphQL)
  • Database: MongoDB
  • ORM: Prisma
  • Authentication: JWT + Google OAuth2 (Passport)
  • WebSockets: Socket.io (planned for AI real-time chat)
  • Testing: Jest, Supertest
  • Logging: Pino
  • Code Quality: ESLint, Prettier

📁 Project Structure

Main folders:

├── __tests__/           # Unit & integration tests
├── src/                 # Main source code
│   ├── configs/         # App configuration
│   ├── controllers/     # GraphQL resolvers & controllers
│   ├── graphql/         # GraphQL schema, resolvers, context, loaders
│   ├── middlewares/     # Authentication & custom middleware
│   ├── prisma/          # Prisma schema and client
│   ├── routes/          # API routes (if any REST endpoints kept)
│   ├── services/        # Core business logic
│   ├── types/           # TypeScript & GraphQL type definitions
│   ├── utils/           # Utility functions
│   ├── validators/      # Input validation
│   ├── index.ts         # Main application entry point
│   ├── seed.ts          # Database seeder
│   └── socket.ts        # Socket.io config (future AI real-time support)
├── .env                 # Environment variables
├── .gitignore
├── .prettierrc
├── codegen.ts           # GraphQL codegen config
├── eslint.config.mjs    # ESLint config
├── jest.config.ts       # Jest config
├── LICENSE
├── package.json
├── tsconfig.json
└── README.md

🔑 GraphQL API

GraphQL replaces REST — all queries and mutations are handled through the Apollo Server.

🧍‍♂️ User & Auth

📁 Projects & ✅ Tasks

📉 Projects & Tasks Insights


🔒 Security Features

  • JWT-based authentication
  • Password hashing with bcrypt
  • Protected GraphQL resolvers
  • Input validation and sanitization
  • CORS protection via middleware

⚙️ Environment Variables

Create a .env file in the root directory with:

NODE_ENV=development
PORT=4000
MONGO_URL=mongodb://localhost:27017/project_manager

JWT_SECRET=your_jwt_secret
JWT_SIGNED_TOKEN=test_token

EMAIL_SENDER_USERNAME=your_email
EMAIL_SENDER_PASSWORD=your_password
EMAIL_SENDER=no-reply@projectmanager.com

GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_secret
GOOGLE_CB_URL=http://localhost:4000/auth/google/callback

FRONTEND_URL=http://localhost:3000

GEMINI_API_KEY=your_ai_key
GEMINI_MODEL=gemini-pro

🧪 Scripts

Script Description
npm run dev Run server in development (TSX)
npm run build Build project to dist/
npm start Run compiled JS in dist/index.js
npm test Run tests with Jest
npm graphqltypes generate GraphQL Types
npm run seed Seed the database
npm run lint Fix lint issues
npm run format Format code using Prettier

🗃️ Prisma Commands

  • Generate Prisma Client:

    npx prisma generate
  • Run Migrations:

    npx prisma migrate dev
  • Seed Database:

    npm run seed

📝 To Implement (Planned Features)

  • 🔄 Real-time AI With GraphQL Subscription
  • 🔬 GraphQL Testing

🧑‍💻 Author

Mostafa Hasan LinkedIn | GitHub


📄 License

This project is licensed under the ISC License.


🤝 Contributions

Contributions, issues, and feature requests are welcome! Feel free to open a PR or issue to get involved.

About

A robust and scalable backend API for a project management backend. Built with Node.js, TypeScript, Apollo Server (GraphQL), MongoDB, Prisma ORM, DataLoader, and powered by JWT & Google OAuth authentication.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages