Technical Test: Node.js Developer with TypeScript, Fastify, Prisma, and Yarn Monorepo
This monorepo contains multiple packages working together to create a complete API solution:
packages/
├── types/ # Shared TypeScript types and interfaces
├── utilities/ # Shared utility functions
├── services/ # Business logic services
└── api/ # Main Fastify API server
- Fastify - Fast and efficient web framework for Node.js
- TypeScript - Static typing for better safety and productivity
- Zod - Schema validation and type-safe serialization
- PostgreSQL - Robust relational database
- Prisma - Modern ORM with type-safety and migrations
- TSyringe - Dependency injection with decorators
- Monorepo - Multi-package management with Yarn Workspaces
- Dependency Inversion - Interfaces for decoupling
- AWS S3 - Cloud file storage
- Multipart Upload - File handling with validation
- WebSockets - Real-time notifications
- JWT - Secure stateless authentication
- Jest - Testing framework with mocks
- Biome - Fast linting and formatting
- Docker - Containerization for development and production
- Node.js >= 20.0.0
- Yarn (for workspace management)
- PostgreSQL database
- Clone the repository:
git clone https://github.com/javierlinked/fastify-prisma-monorepo
cd fastify-prisma-monorepo- Install dependencies:
yarn install- Set up environment variables:
cp .env.example .env
# Edit .env file with your database and AWS credentials- Generate Prisma client:
yarn db:generate- Run database migrations:
yarn db:migrateyarn devThis starts the API server with hot reload using tsx watch.
The build process follows the correct dependency order:
yarn buildThis executes:
yarn build:types- Build shared typesyarn build:utilities- Build utility functionsyarn build:services- Build business logic servicesyarn build:api- Build main API server
# Run all tests
yarn test
# Run tests for specific package
yarn workspace @asafe/api test
yarn workspace @asafe/services test
yarn workspace @asafe/utilities test# Check linting and format issues
yarn check
# Fix all issues
yarn fix# Generate Prisma client
yarn db:generate
# Run migrations
yarn db:migrate
# Open Prisma Studio
yarn db:studio📖 Detailed Documentation:
- Architecture - System architecture and package details
- API Documentation - Endpoints and WebSocket features
- Deployment Guide - Production deployment instructions
- Dependency injection with TSyringe
- Centralized environment variables
- Singleton services with decorators
- Interfaces for abstractions
- File uploads to S3
- WebSocket with JWT authentication
- Rate limiting for APIs
- Improve file handling in users PUT
- Implement caching with Redis
- Structured logging with context
- Metrics and monitoring
- Complete integration tests
- Automated CI/CD pipeline