Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js (v18.0.0 or higher)
  • npm (comes with Node.js)
  • Git
We recommend using nvm to manage Node.js versions.

Technology Stack

upLegal is built with:
  • Vite - Build tool and dev server
  • TypeScript - Type-safe JavaScript
  • React - UI framework
  • shadcn-ui - Component library
  • Tailwind CSS - Utility-first CSS framework
  • Express - Backend server
  • Supabase - Database and authentication
  • MercadoPago - Payment processing

Installation

1

Clone the repository

git clone <YOUR_GIT_URL>
cd <YOUR_PROJECT_NAME>
2

Install dependencies

npm install
3

Configure environment variables

Create a .env.local file in the root directory and configure the required environment variables.See Environment Variables for the complete list.
4

Start the development server

npm run dev
The application will be available at http://localhost:3001

Development Scripts

The following npm scripts are available:
ScriptCommandDescription
devnpm run devStart Vite development server on port 3001
buildnpm run buildBuild for production
build:devnpm run build:devBuild in development mode (with sourcemaps)
lintnpm run lintRun ESLint to check code quality
previewnpm run previewPreview production build locally on port 8080
servernpm run serverRun the Express backend server (port 3000)
startnpm run startRun both backend server and Vite concurrently

Development Workflow

Running Frontend Only

For frontend-only development:
npm run dev
This starts the Vite dev server with:
  • Hot Module Replacement (HMR)
  • Port: 3001
  • API proxy configured to localhost:3000

Running Full Stack

To run both frontend and backend:
npm start
This concurrently runs:
  • Express backend server on port 3000
  • Vite frontend on port 3001

Backend Server Only

To run just the backend:
npm run server

Development Environment

Vite Configuration

The Vite dev server is configured with:
  • Host: :: (listens on all interfaces)
  • Port: 3001
  • HMR Port: 3002
  • API Proxy: /api routes proxied to http://localhost:3000
  • Allowed Hosts: Includes ngrok domains for webhook testing

Hot Module Replacement

Vite provides instant HMR for:
  • React components
  • CSS/Tailwind changes
  • TypeScript modules

Path Aliases

The @ alias is configured to reference the src directory:
import { Button } from '@/components/ui/button';

Alternative Development Options

GitHub Codespaces

1

Navigate to your repository

Go to the main page of your GitHub repository.
2

Open Codespaces

Click the “Code” button (green) near the top right.
3

Create new Codespace

Select the “Codespaces” tab and click “New codespace”.
4

Start developing

Edit files directly in the browser-based VS Code environment.

Direct GitHub Editing

For quick fixes:
  1. Navigate to the desired file in GitHub
  2. Click the “Edit” button (pencil icon)
  3. Make changes and commit directly

Troubleshooting

Port Already in Use

If port 3001 is already in use:
# Find and kill the process using port 3001
lsof -ti:3001 | xargs kill -9

Module Resolution Issues

Clear node_modules and reinstall:
rm -rf node_modules package-lock.json
npm install

Environment Variables Not Loading

Ensure your .env.local file is in the project root and variables are prefixed with VITE_ for frontend access.

Next Steps

Build docs developers (and LLMs) love