Quick Start Guide
Get PaparcApp up and running on your local machine in just a few minutes. This guide walks you through cloning the repository, installing dependencies, configuring the database, and starting the development server.Prerequisites: Make sure you have Node.js 18+ and PostgreSQL 14+ installed before proceeding.
Step-by-Step Setup
Clone the Repository
Clone the PaparcApp source code to your local machine:The main application code is located in the
proyecto/ directory.Install Dependencies
Install all required npm packages:This will install:
- express (4.21.2) - Web framework
- pg (8.17.2) - PostgreSQL driver
- bcrypt (6.0.0) - Password hashing
- ejs (3.1.10) - Template engine
- express-session (1.18.2) - Session management
- firebase (12.9.0) - Social authentication
- axios (1.13.4) - HTTP client for notifications
- And more…
View all dependencies
View all dependencies
package.json dependencies
Configure Environment Variables
Create a Edit the
.env file from the example template:.env file with your local configuration:.env
Generate a secure SESSION_SECRET
Generate a secure SESSION_SECRET
You can generate a secure random string using Node.js:Or use any password generator with at least 32 characters.
Set Up the Database
Create the PostgreSQL database and load the schema:What each file does:
| File | Purpose |
|---|---|
01_tables.sql | Creates all 13 tables (customer, vehicle, reservation, etc.) |
02_constraints.sql | Adds foreign keys and CHECK constraints (business rules) |
03_indexes.sql | Creates 9 performance indexes for common queries |
04_initial_data.sql | Loads initial data: pricing tiers, services, test customers |
The initial data includes a complete test scenario with sample customers, vehicles, reservations, and the full pricing catalog.
Start the Development Server
Launch the application with hot-reload enabled:You should see output similar to:
Access the Application
Open your browser and navigate to:You should see the PaparcApp landing page with:
Local URL: http://localhost:3000
- Hero section with booking date selectors
- Three service tiers (ECO, TRANSFER, MEET)
- FAQ accordion
- Navigation to services, pricing, and login pages
Testing the Application
Once the server is running, try these workflows:Public Booking Flow
Navigate to Booking
Click “Book Now” or go to http://localhost:3000/booking
Enter Vehicle Details
- License plate:
TEST1234 - Brand:
Toyota - Model:
Corolla - Color:
Blue - Type:
TURISMO(car)
Enter Personal Info
- Name:
Test Customer - Phone:
+34600000000 - Email:
[email protected]
Choose Services
- Select a main service (ECO recommended for testing)
- Optionally add additional services
- Watch the price update in real-time
Admin Dashboard Access
Navigate to Login
Use Test Admin Credentials
Check your
04_initial_data.sql file for admin credentials, or create an admin user:Generate bcrypt hash for password
Generate bcrypt hash for password
Available NPM Scripts
| Script | Command | Description |
|---|---|---|
| Production | npm start | Starts server with Node.js (no hot-reload) |
| Development | npm run dev | Starts with Nodemon (auto-restart on changes) |
| Tests | npm test | Runs Jest test suite for pricing service |
Verify Installation
To confirm everything is working correctly:Check Database Connection
Check Database Connection
Check Pricing Cache
Check Pricing Cache
When you start the server, look for:This means the pricing service loaded all vehicle coefficients and service rates into memory.
Test API Endpoint
Test API Endpoint
Run Test Suite
Run Test Suite
Troubleshooting
Error: connect ECONNREFUSED
Error: connect ECONNREFUSED
Problem: Cannot connect to PostgreSQL database.Solutions:
- Check PostgreSQL is running:
sudo service postgresql status - Verify connection settings in
.envmatch your PostgreSQL config - Test connection:
psql -U postgres -d paparcapp_db -c "SELECT 1;"
Error: Pricing cache initialization failed
Error: Pricing cache initialization failed
Problem: Cannot load pricing data from database.Solutions:
- Ensure
04_initial_data.sqlwas executed successfully - Check tables exist:
psql -U postgres -d paparcapp_db -c "\dt" - Verify data loaded:
SELECT * FROM vehicle_coefficient; - Restart the server after fixing database issues
Port 3000 already in use
Port 3000 already in use
Problem: Another process is using port 3000.Solutions:
- Change the port in
.env:PORT=3001 - Kill the process:
lsof -ti:3000 | xargs kill - Use a different port temporarily:
PORT=3001 npm run dev
Session not persisting
Session not persisting
Problem: Login doesn’t work or session expires immediately.Solutions:
- Check
SESSION_SECRETis set in.env - Clear browser cookies and try again
- Verify
express-sessionis installed:npm ls express-session
Next Steps
Detailed Installation
Learn about prerequisites, environment configuration, and deployment options
API Reference
Explore the REST API endpoints for pricing and reservations
Database Schema
Understand the 13-table architecture and relationships
Architecture Guide
Deep dive into the MVC pattern and service layers
Need Help? Check the detailed Installation Guide for more configuration options and troubleshooting tips.
