FastE is a high-performance, scalable E-commerce backend built with the NestJS framework. It leverages modern technologies like Prisma ORM, Elasticsearch, Redis, RabbitMQ, and AWS S3 to provide a robust foundation for a full-featured e-commerce platform.
-
Authentication & Authorization:
- Global Guard for route protection.
- JWT based authentication (Access & Refresh tokens).
- Google OAuth2 social login integration.
- Role-based Access Control (RBAC) and Permissions.
- OTP verification system via email.
-
Product Management:
- Comprehensive Product, Category, and Brand modules.
- Advanced search powered by Elasticsearch.
- Dynamic widgets and templates for homepage customization.
- Flash sale management.
-
Order & Cart:
- Real-time cart management.
- Order processing workflow.
- Multiple delivery types and address shipping management.
- Payment integration.
-
Real-time & Communication:
- Real-time notifications and updates via Socket.io.
- Background tasks and email processing using BullMQ (Redis-backed).
- Microservices communication via RabbitMQ (AMQP).
-
Media & Infrastructure:
- File uploads and storage using AWS S3.
- Multi-language support (I18n).
- Database management with Prisma (PostgreSQL).
- Security headers with Helmet.
- Health checks and system monitoring (Terminus).
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL (via Prisma)
- Cache & Queues: Redis, BullMQ
- Message Broker: RabbitMQ
- Search Engine: Elasticsearch
- Storage: AWS S3
- Validation: Zod & nestjs-zod
- Documentation: Swagger (OpenAPI)
Before running the application, ensure you have the following installed:
- Node.js (v18 or higher recommended)
- npm
- PostgreSQL
- Redis
- RabbitMQ (optional, if using microservices)
- Elasticsearch (optional, for search features)
-
Clone the repository
git clone <repository-url> cd faste-server
-
Install dependencies
npm install
-
Configure Environment Variables Copy the example environment file and fill in your local values:
cp .env.example .env
-
Database Migration
npx prisma generate npx prisma migrate dev
The backend includes a modular cron task system utilizing @nestjs/schedule to run background jobs.
You can configure the cron system using the CRON_ENABLED environment variable:
CRON_ENABLED=true(default): Enables all background tasks, including:- Flash Sale Status Transition (runs every minute): Automates live/scheduled/ended transitions for flash sales.
- Product Views Synchronization (runs every day at midnight): Syncs daily unique product views from Redis HyperLogLog (HLL) to the PostgreSQL database
totalViewscolumn and cleans up processed keys. - Verification Code Cleanup (runs every hour): Removes expired verification codes.
CRON_ENABLED=false: Fully disables all scheduled cron tasks and prevents scheduling hooks from being registered.
# development
$ npm run start
# watch mode (recommended for development)
$ npm run start:dev
# production mode
$ npm run start:prodOnce the server is running, you can access the Swagger documentation at:
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:covThis project is licensed under the UNLICENSED terms. © Copyright belongs to the account [ahkiet lekiett2201@gmail.com]. Unauthorized copying, selling, distribution, or modification is prohibited.