Skip to main content

Installation Guide

This guide covers detailed installation instructions for PC Fix, including manual setup without Docker, all dependencies, database configuration, and deployment options.
For a quick Docker-based setup, see the Quick Start Guide. This guide is for developers who need manual installation or want to understand the complete setup process.

Prerequisites

Required Software

Node.js 20+

Download from nodejs.orgVerify installation:

PostgreSQL 15+

Download from postgresql.orgVerify installation:

Git

Download from git-scm.comVerify installation:

Docker (Optional)

Download from docker.comOnly required for containerized deployment

System Requirements

  • OS: Linux, macOS, or Windows with WSL2
  • RAM: Minimum 4GB, recommended 8GB+
  • Disk Space: 2GB for dependencies and builds
  • Ports Available: 3001 (API), 4321 (Web), 5432 (PostgreSQL)

Installation Methods

Database Configuration

Prisma Schema Overview

PC Fix uses Prisma ORM with PostgreSQL. The schema includes:
  • User: User accounts with role-based access
  • RefreshToken: JWT refresh token management
  • Cliente: Extended customer profiles with addresses
  • Localidad & Provincia: Location data for Argentina
  • Producto: Product catalog with inventory tracking
  • Categoria: Product categories (hierarchical)
  • Marca: Brand management
  • ImagenProducto: Multiple images per product
  • Favorite: User wishlists
  • Cart & CartItem: Shopping cart management
  • Venta: Orders and sales
  • ItemVenta: Order line items
  • Pago: Payment tracking with multiple methods
  • ConsultaTecnica: Technical consultation requests
  • Servicio: Service offerings
  • ServicioPersonalizado: Custom service pricing
  • Banner: Homepage banners and promotions
  • Settings: Site configuration

Common Prisma Commands

External Services Configuration

Cloudinary (Image CDN)

1

Create Account

Sign up at cloudinary.com
2

Get Credentials

Find your credentials in Dashboard → Account Details:
  • Cloud Name
  • API Key
  • API Secret
3

Add to .env

MercadoPago (Payment Gateway)

1

Create Account

Sign up at mercadopago.com
2

Get API Credentials

Navigate to Developers → Credentials:
  • Access Token (for backend)
  • Public Key (for frontend)
3

Add to .env

Google OAuth

1

Create Project

2

Enable OAuth

APIs & Services → Credentials → Create OAuth Client ID
  • Application type: Web application
  • Authorized redirect URIs: http://localhost:3001/api/auth/google/callback
3

Add Credentials

Resend (Email Service)

1

Create Account

Sign up at resend.com
2

Generate API Key

Dashboard → API Keys → Create API Key
3

Verify Domain (Production)

Add your domain for production email sending
4

Add to .env

Sentry (Error Monitoring)

1

Create Project

Sign up at sentry.io and create a project
2

Get DSN

Project Settings → Client Keys (DSN)
3

Add to Both .env Files

NPM Scripts Reference

Root Level Commands

API Package (packages/api)

Web Package (packages/web)

Troubleshooting

Error: Error: P1001: Can't reach database serverSolutions:
  1. Verify PostgreSQL is running:
  2. Check DATABASE_URL format:
  3. Test connection directly:
Error: Cannot find module '@prisma/client'Solution:
After schema changes, always regenerate the client.
Error: Port 3001 (or 4321) is already in useSolutions:
  1. Find and kill the process:
  2. Change port in .env:
Error: Various “Cannot find module” errorsSolution:
Error: Access to fetch has been blocked by CORS policySolution: Ensure API .env has correct CORS_ORIGIN:
For multiple origins:
Error: JsonWebTokenError: invalid signatureSolutions:
  1. Ensure JWT secrets are set in .env
  2. Clear browser cookies and local storage
  3. Restart the API server after changing JWT secrets
Solution:
Common fixes:
  • Update @types/* packages
  • Check tsconfig.json settings
  • Regenerate Prisma client

Production Deployment

Environment Preparation

1

Update Environment Variables

  • Change all secrets (JWT, database passwords)
  • Update CORS_ORIGIN to production domain
  • Configure production database URL
  • Set NODE_ENV=production
2

Build Applications

3

Run Database Migrations

Deployment Options

Vercel (Frontend)

Best for: Astro frontend deployment
  1. Connect GitHub repository
  2. Set root directory: packages/web
  3. Add environment variables
  4. Deploy automatically on push

Railway (Backend + DB)

Best for: Express API and PostgreSQL
  1. Create new project
  2. Add PostgreSQL database
  3. Deploy API from GitHub
  4. Configure environment variables

Docker Production

Best for: Self-hosted deployments

VPS (DigitalOcean, AWS)

Best for: Full control deployments
  1. Set up Node.js 20+
  2. Install PostgreSQL
  3. Clone repository
  4. Configure PM2 or systemd
  5. Set up Nginx reverse proxy

Testing

Run Tests

Test Configuration

  • Vitest: Unit testing for both packages
  • Playwright: E2E testing for critical user flows
  • Supertest: API endpoint testing

Next Steps

Explore the Codebase

  • API structure: packages/api/src/modules/
  • Frontend components: packages/web/src/components/
  • Database schema: packages/api/prisma/schema.prisma

Configure Admin Account

Create admin user via Prisma Studio or seed script to access admin dashboard

Customize Branding

  • Update logo: packages/web/public/logo.png
  • Modify colors: packages/web/tailwind.config.mjs
  • Edit site metadata: packages/web/src/layouts/Layout.astro

Set Up External Services

Configure Cloudinary, MercadoPago, and email services for full functionality