Appearance
Getting Started
Set up your local development environment for Megapay HR.
Prerequisites
- Node.js 18+
- pnpm package manager
- Git for version control
Installation
First, clone the repository and install dependencies:
bash
# Clone the repository
git clone <repository-url>
cd megapay-hr
# Install all dependencies
pnpm installWhy pnpm?
This project uses pnpm for faster installs and better disk space efficiency. If you don't have pnpm installed, run npm install -g pnpm.
Development Setup
Choose one of two development modes based on your needs:
Option 1: Frontend Only (Recommended for UI Development)
Best for working on frontend features without setting up the full backend infrastructure.
1. Create environment file:
Create a .env file in the apps/frontend directory:
bash
# apps/frontend/.env
API_BASE_URL=https://api.dev.megapayapp.com2. Start the development server:
bash
cd apps/frontend
pnpm run devThe frontend will be available at http://localhost:3000 and will connect to the development API.
Hot Reload
The dev server supports hot module replacement (HMR) - your changes will appear instantly without refreshing.
Option 2: Full Stack with SST (For Backend Development)
Best for working on backend features or testing full-stack changes locally.
1. Set up AWS credentials:
Create or update your AWS credentials file. The exact location depends on your needs:
bash
# ~/.aws/credentials (for your personal dev environment)
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_KEYOr create a credentials file specific to this project (check with your team for the correct path).
2. Start SST development mode:
From the root directory:
bash
npx sst devThis will:
- Deploy backend resources to AWS
- Start the frontend dev server
- Set up live Lambda development
- Connect everything together
First Run
The first npx sst dev run takes longer as it deploys all infrastructure. Subsequent runs are much faster.
Verify Installation
Once your dev server is running, verify everything works:
- Open
http://localhost:3000in your browser - You should see the Megapay HR login page
- Try navigating to a few pages to ensure routing works
Development Workflow
Frontend-Only Mode
bash
# Terminal 1: Run frontend dev server
cd apps/frontend
pnpm run dev
# Make changes to files in apps/frontend/app/
# Browser will auto-reload with your changesFull Stack Mode
bash
# Terminal 1: Run SST
npx sst dev
# SST will show you URLs for:
# - Frontend (usually http://localhost:3000)
# - Backend API endpoints
# - AWS resources being usedCommon Commands
bash
# Install dependencies
pnpm install
# Frontend only
cd apps/frontend
pnpm run dev # Start dev server
pnpm run build # Build for production
pnpm run preview # Preview production build
# Backend (from root)
cd apps/backend
pnpm run build # Compile TypeScript
# Full stack (from root)
npx sst dev # Start development
npx sst deploy # Deploy to AWS
npx sst remove # Remove deploymentProject Structure
megapay-hr/
├── apps/
│ ├── frontend/ # Nuxt 3 frontend application
│ ├── backend/ # Backend API (Hono + Drizzle)
│ ├── docs/ # This documentation site
│ └── dbSeeding/ # Database seeding scripts
├── infra/ # SST infrastructure definitions
└── packages/ # Shared packagesIDE Setup
VS Code (Recommended)
Install these extensions for the best experience:
- Vue - Official (Vue.js language support)
- TypeScript Vue Plugin (Volar) (TypeScript support in Vue files)
- Tailwind CSS IntelliSense (Tailwind autocomplete)
- ESLint (Linting)
WebStorm
WebStorm has built-in support for Vue, TypeScript, and Tailwind. No additional plugins needed.
Environment Variables
Frontend Environment Variables
Create apps/frontend/.env:
bash
# Required for frontend-only mode
API_BASE_URL=https://api.dev.megapayapp.com
# Optional
NUXT_PUBLIC_API_BASE_URL=https://api.dev.megapayapp.comDon't Commit .env
The .env file is gitignored. Never commit credentials or API keys.
Troubleshooting
Port Already in Use
If port 3000 is already in use:
bash
# Option 1: Kill the process using the port
lsof -ti:3000 | xargs kill -9
# Option 2: Use a different port
PORT=3001 pnpm run devpnpm install fails
bash
# Clear pnpm cache
pnpm store prune
# Remove node_modules and try again
rm -rf node_modules
pnpm installSST deployment fails
bash
# Check AWS credentials are set correctly
aws sts get-caller-identity
# Remove .sst directory and try again
rm -rf .sst
npx sst devTypeScript errors in IDE
bash
# Restart TypeScript server in VS Code
# Command Palette (Cmd+Shift+P) > "TypeScript: Restart TS Server"
# Or regenerate types
cd apps/frontend
pnpm run dev # Types are generated on dev server startNext Steps
Now that your environment is set up, learn about:
- Folder Structure → - Understand the project organization
- API Calls → - Make your first API request
- Routing → - Navigate between pages
- UI Components → - Build beautiful interfaces
Ready to code? Start with the Folder Structure guide to understand how the project is organized.