Prerequisites
Before you begin, ensure you have the following installed on your system:Node.js
Version 18.x or higher recommended
PostgreSQL
Version 14.x or higher for the database
npm
Comes with Node.js installation
Git
For version control and cloning the repository
Clone the repository
Start by cloning the Lens Music repository to your local machine:Configure environment variables
The API requires environment variables to connect to the database and configure the server.Configure database connection
Open the
.env file and configure your PostgreSQL connection:.env
Replace
your_postgres_user, your_postgres_password, and lens_music with your actual PostgreSQL credentials and desired database name.Quick start with dev script
The easiest way to run both the API and client is using the provideddev.sh script:
Manual setup
If you prefer to run the servers manually or need more control:- API Server
- Client Application
Verify the installation
Once both servers are running, verify the installation:Check API health
Check API health
Open your browser or use curl to check the API:You should receive a response from the NestJS server.
Access the client
Access the client
Navigate to
http://localhost:5173 in your browser. You should see the Lens Music landing page.Check database connection
Check database connection
Verify that the API can connect to PostgreSQL by checking the server logs for any connection errors.
Available scripts
Here are the key npm scripts available in each workspace:API Scripts
| Script | Command | Description |
|---|---|---|
| Development | npm run dev | Start the API server with hot reload using nodemon |
| Build | npm run build | Compile TypeScript to JavaScript in the dist/ folder |
| Start | npm run start | Run the production build |
| Seed | npm run seed | Populate the database with seed data |
Client Scripts
| Script | Command | Description |
|---|---|---|
| Development | npm run dev | Start Vite development server with hot module replacement |
| Build | npm run build | Build the production-ready client application |
| Preview | npm run preview | Preview the production build locally |
| Lint | npm run lint | Run ESLint to check for code issues |
Next steps
Monorepo structure
Learn about the project organization and directory structure
Database schema
Understand the database entities and relationships
Environment variables
Complete reference for all configuration options
API reference
Explore the API endpoints and usage