Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Legacy Dashboard Application

A full-stack application built with Next.js and NestJS that requires some attention. You'll be fixing bugs, optimizing performance, and improving the user experience.

Tech Stack

  • Frontend: Next.js 14, React 18, Tailwind CSS, TypeScript
  • Backend: NestJS, TypeORM, PostgreSQL
  • Database: PostgreSQL 15

Prerequisites

  • Node.js 18+ (LTS recommended)
  • Docker and Docker Compose
  • Git

Getting Started

1. Clone the Repository

git clone <repository-url>
cd technical-assessment

2. Start the Database

docker-compose up -d

This will start:

  • PostgreSQL on port 5432
  • pgAdmin on port 5050 (optional, for database management)
    • Email: admin@test.com
    • Password: admin

3. Setup Backend

cd backend
npm install

4. Seed the Database

This will populate the database with sample data including 100,000 products:

npm run seed

⚠️ The seeding process takes a few minutes. You'll see progress in the console.

5. Start the Backend Server

npm run start:dev

The backend will run on http://localhost:3001

6. Setup Frontend (in a new terminal)

cd frontend
npm install

7. Start the Frontend

npm run dev

The frontend will run on http://localhost:3000

Project Structure

technical-assessment/
├── frontend/                # Next.js application
│   ├── src/
│   │   ├── app/            # App router pages
│   │   ├── components/     # React components
│   │   └── lib/            # Utilities and API client
│   └── ...
├── backend/                 # NestJS application
│   ├── src/
│   │   ├── products/       # Products module
│   │   ├── posts/          # Posts module
│   │   ├── users/          # Users module
│   │   └── database/       # Database utilities and seeder
│   └── ...
└── docker-compose.yml       # Docker services configuration

API Endpoints

Products

  • GET /products - List all products
  • GET /products/stats - Get product statistics
  • GET /products/export - Export all products
  • GET /products/:id - Get single product
  • POST /products - Create product

Posts

  • GET /posts - List all posts
  • GET /posts/:id - Get single post
  • POST /posts - Create post
  • PUT /posts/:id - Update post
  • DELETE /posts/:id - Delete post

Users

  • GET /users - List all users
  • GET /users/profile/:id - Get user profile
  • GET /users/:id - Get single user
  • POST /users - Create user
  • PUT /users/:id - Update user

Environment Variables

Backend (.env)

DB_HOST=localhost
DB_PORT=5432
DB_USER=assessment
DB_PASSWORD=assessment123
DB_NAME=legacy_app

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:3001

Troubleshooting

Database Connection Issues

Make sure Docker is running and the PostgreSQL container is healthy:

docker-compose ps

Port Conflicts

If ports 3000, 3001, 5432, or 5050 are in use, you can modify them in:

  • docker-compose.yml for database ports
  • backend/src/main.ts for backend port
  • Frontend uses Next.js default port 3000

Reseed Database

To reset and reseed the database:

cd backend
npm run seed

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages