A comprehensive NestJS API for the Urembo Hub beauty services and e-commerce platform, migrated from Supabase with Prisma and PostgreSQL.
The application includes the following main entities:
Clone and navigate to the project:
cd urembo-hub-api
Install dependencies:
npm install
Environment Configuration:
cp env.example .env
Update the .env file with your configuration:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/urembo_hub?schema=public"
# JWT
JWT_SECRET="your-super-secret-jwt-key-here"
JWT_EXPIRES_IN="7d"
# Application
PORT=3000
NODE_ENV=development
# External Services
PAYSTACK_SECRET_KEY="your-paystack-secret-key"
PAYSTACK_PUBLIC_KEY="your-paystack-public-key"
RESEND_API_KEY="your-resend-api-key"
# Email
FROM_EMAIL="noreply@urembohub.com"
FROM_NAME="Urembo Hub"
Database Setup:
# Create the database (run this in your PostgreSQL client)
CREATE DATABASE urembo_hub;
# Run migrations
npx prisma migrate dev --name init
# Generate Prisma client
npx prisma generate
Start the application:
# Development mode
npm run start:dev
# Production mode
npm run start:prod
POST /auth/login - User loginPOST /auth/register - User registrationGET /auth/profile - Get user profile (protected)GET /users - Get all users (with pagination and filtering)GET /users/:id - Get user by IDPUT /users/profile - Update user profile (protected)PATCH /users/:id/verify - Verify user (admin only)DELETE /users/:id - Delete user (admin only)GET /products - Get all products (with pagination and filtering)GET /products/:id - Get product by IDPOST /products - Create product (retailers/manufacturers only)PUT /products/:id - Update product (owner/admin only)DELETE /products/:id - Delete product (owner/admin only)GET /products/my/products - Get user's products (protected)GET /services - Get all services (with pagination and filtering)GET /services/:id - Get service by IDPOST /services - Create service (vendors only)PUT /services/:id - Update service (owner/admin only)DELETE /services/:id - Delete service (owner/admin only)GET /services/my/services - Get user's services (protected)GET /orders - Get all orders (with pagination and filtering)GET /orders/:id - Get order by IDPOST /orders - Create order (guest users)POST /orders/authenticated - Create order (authenticated users)PUT /orders/:id - Update order (owner/admin/related business users)GET /orders/my/orders - Get user's orders (protected)GET /appointments - Get all appointmentsPOST /payments/process - Process paymentGET /tickets - Get all ticketsGET /commission/settings - Get commission settingsGET /cms/settings - Get CMS settingsThis NestJS application was created by analyzing the existing Supabase application and migrating the database schema and business logic. The migration includes:
npm run start:dev
# View database in Prisma Studio
npx prisma studio
# Reset database
npx prisma migrate reset
# Deploy migrations
npx prisma migrate deploy
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
npx prisma migrate deploynpm run buildnpm run start:prodThis project is licensed under the MIT License.
For support and questions, please contact the development team or create an issue in the repository.