Task Management API
Table of Contents
- Environments
- Tech Stack
- Features
- Steps to Run the Project Locally
- Scripts
- API Documentation
- Deployment Instructions
Environments
- Node.js: 23
- Package Manager: pnpm
Tech Stack
- Backend Framework: Hono
- Validation: Zod
- API Documentation: Hono Zod-OpenAPI, Hono Swagger-UI
- ORM: Drizzle ORM
- Database: PostgreSQL
- Testing: Vitest
Features
Employee Role
- View Assigned Tasks
Employees can only view tasks specifically assigned to them. - Update Task Status
Employees can update the status of their tasks (e.g., "In Progress," "Completed").
Employer Role
- Create and Assign Tasks
Employers can create tasks and assign them to employees. - View All Tasks with Filtering and Sorting
- Filter By: Assignee, Status (e.g., "Pending," "In Progress," "Completed").
- Sort By: Creation Date, Due Date, Task Status (e.g., Active or Completed).
- View Employee Task Summary
- Total number of tasks assigned to an employee.
- Number of tasks completed by each employee.
Steps to Run the Project Locally
1. Clone the Project:
First, clone the project repository to your local machine:
git clone <your-repo-url>
cd <your-project-directory>2. Install Dependencies:
Install the required dependencies using pnpm:
pnpm install3. Set Up Environment Variables:
Create a .env file in the root directory of the project (if it's not already present).
Example .env:
PORT= # port of server
DATABASE_URL= # PostgreSQL connection string4. Run Database Migrations (for development):
To apply pending migrations and update the local development database schema, run:
pnpm db:migrate5. (Optional) Seed the Database:
If you want to populate the database with mock data for testing, use the seeding script:
pnpm db:seed6. Start the Development Server:
Now you can start the development server with hot-reloading enabled:
pnpm devThis will run the server on http://localhost:8000 (by default) and the swagger doc will live on http://localhost:8000/api/doc.
Scripts
Development
- pnpm dev
Starts the development server with hot-reloading.
Production
- pnpm build
Builds the application for production.
Database Management
-
pnpm db:generate
Generates a new migration file. -
pnpm db:migrate
Applies migrations to update the database schema. -
pnpm db:seed
Seeds the database with mock data. -
pnpm db:studio
Opens Prisma Studio for database interaction.
Testing
- pnpm test
Runs the tests using Vitest.
API Documentation
API documentation is available via Swagger:
Deployment Instructions
Using Docker
- Build the Docker image:
docker build -t task-management-api .- Run the container:
docker run -p 8000:8000 --env-file .env task-management-api- The application will be accessible at http://localhost:8000.
Using Docker Compose
- Run the application:
docker-compose up --build