A backend system for tracking time entries, projects, and reports.
Built with Express + TypeScript + MongoDB, following best practices.
- User authentication (JWT-based)
- CRUD for Timesheets
- CRUD for Projects
- Role-based Access Control (Admin, Employee, Manager)
- API Documentation (TsSpec X SwaggerUI)
- Express (TypeScript)
- MongoDB (Mongoose)
- Jest + Supertest (Testing)
- ESLint + Prettier (Linting/Formatting)
- TsSpec X Swagger (API Docs)
git clone https://github.com/Timesheets-By-Exploit/backend.git
cd backend
npm install
npm run devAlways start new branches from develop, not from other feature branches.
# Create and switch to a new branch
git checkout -b feature/feature-namegit push -u origin feature/feature-name👉 -u sets the upstream, so future git push/git pull works without arguments.
# Rename current branch
git branch -m new-name
# Rename a different branch
git branch -m old-name new-nameFor remote:
git push origin --delete old-name
git push -u origin new-namegit checkout develop
git checkout feature/feature-name# While on your feature branch
git fetch origin
git rebase origin/develop
# or
git merge origin/developPrefer rebase for clean history, merge for simplicity.
git add .
git commit -m "feat(auth): implement signup endpoint"
git pushFollow Conventional Commits:
feat:→ new featurefix:→ bug fixtest:→ testing workdocs:→ documentation updatesrefactor:→ code refactoringchore:→ maintenance (configs, deps)
Examples:
feat(auth): add signup API for org owners
test(auth): add validation tests for signup
docs(readme): add setup instructions- Push branch to remote.
- Open PR into
develop(notmain). - Review → squash/merge.
git checkout main
git checkout -b hotfix/fix-loginAfter fix:
git commit -m "fix(auth): handle null password bug"
git push -u origin hotfix/fix-loginOpen PR → merge into main and develop.
# Local
git branch -d feature/auth-signup
# Remote
git push origin --delete feature/auth-signuptimesheets-backend/
│
├── .github/ # GitHub Actions CI/CD workflows
├── .husky/ # Git hooks (linting/tests pre-commit)
├── docs/ # Project documentation (markdowns, API specs)
│ └── tspecGenerator.ts
│
├── src/ # Application source code
│ ├── config/ # App configurations (db, env, logger, etc.)
│ │ ├── db.ts
│ │ └── env.ts
│ │
│ ├── modules/ # Each feature lives here (modular structure)
│ │ ├── module/ # Authentication module
│ │ ├── __tests__/ # Tests specific to module
│ │ ├── module.controller.ts
│ │ ├── module.docs.ts #Tspec Docs
│ │ ├── module.service.ts
│ │ ├── module.model.ts
│ │ ├── module.routes.ts
│ │ └── module.types.ts
│ │
│ │
│ ├── middlewares/ # Custom Express middlewares
│ │ ├── errorHandler.ts
│ │ ├── notFound.ts
│ │ └── validators.ts
│ │
│ ├── utils/ # Utility/helper functions
│ │ ├── index.ts
│ │ └── AppError.ts
│ │
│ ├── app.ts # Express app setup
│ └── server.ts # Server entry point
│
├── .env # Local environment variables
├── .env.example # Sample env file for docs
├── jest.config.ts # Jest config
├── tsconfig.json # TypeScript config
├── package.json
└── README.md