Quickstart Guide
Get the SSP Backend API up and running quickly with this step-by-step guide. You’ll have a working API server in under 5 minutes.Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v18 or higher)
- npm (comes with Node.js)
- PostgreSQL (v12 or higher)
- Git (for cloning the repository)
Installation Steps
Install Dependencies
Install all required npm packages:This will install NestJS, TypeORM, PostgreSQL driver, JWT libraries, and all other dependencies defined in
package.json.Configure Environment Variables
Create a
.env file in the root directory with your database and JWT configuration:Create PostgreSQL Database
Create a new PostgreSQL database for the application:Or use your preferred PostgreSQL GUI tool (pgAdmin, DBeaver, etc.).
Run Database Migrations
TypeORM will automatically run migrations on startup because
migrationsRun: true is configured in src/app.module.ts:24.The application is configured to:- Auto-load entities
- Run migrations automatically
- Not synchronize schema (for safety)
Seed Initial Admin User
Create an initial admin user to access the system:This creates an admin user with:
- Username:
Admin - Password:
Admin1234(or the value ofSEED_ADMIN_PASSWORDfrom.env) - Role: Admin
The seed script checks if the admin already exists and won’t create duplicates. You’ll see ”✅ Admin ya existe: Admin” if the user already exists.
Make Your First API Call
Now that the server is running, let’s authenticate and make your first API call.1. Login to Get JWT Token
Send a POST request to the login endpoint:access_token value - you’ll need it for authenticated requests.
2. Make an Authenticated Request
Use the JWT token to access protected endpoints. For example, list all users:Replace
YOUR_ACCESS_TOKEN_HERE with the actual token from the login response.Testing the API
You can test the API using:- cURL (as shown above)
- Postman or Insomnia (import the endpoints)
- HTTPie - A user-friendly HTTP client
- Thunder Client or REST Client (VS Code extensions)
What’s Next?
Authentication Guide
Learn how JWT authentication and role-based access control work
Database Setup
Deep dive into PostgreSQL configuration and TypeORM entities
Environment Variables
Complete reference of all configuration options
API Reference
Explore all available API endpoints and operations
Troubleshooting
Database connection failed
Database connection failed
Ensure PostgreSQL is running and the credentials in Verify your database credentials and that the database exists.
.env are correct:Port already in use
Port already in use
If port 3000 is already in use, change the Or find and kill the process using port 3000:
PORT in your .env file:JWT token expired
JWT token expired
JWT tokens expire after the duration specified in
JWT_EXPIRES_IN (default: 1 day). Simply login again to get a new token: