mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 14:40:13 -08:00
2.7 KiB
2.7 KiB
Development Environment Setup Guide
Prerequisites
- Windows, macOS, or Linux
- Git
- Node.js (version 18 or higher)
- npm or yarn
- PostgreSQL (local installation or Docker)
Initial Setup
-
Clone the Repository
git clone https://github.com/acedanger/finance.git cd finance -
Install Dependencies
npm install -
Create Environment File
cp .env.example .env -
Configure Database
- Edit the
.envfile with your PostgreSQL connection string:DATABASE_URL="postgresql://username:password@localhost:5432/finance"
- Edit the
-
Set up Database
# Run database migrations npx prisma migrate dev # Seed the database with initial data (optional) npx prisma db seed
Git Hooks
This project uses Git hooks via Husky to enforce code quality:
- Pre-commit Hook:
- Automatically runs Biome checks before each commit
- Prevents committing code with linting or formatting errors
- See HOOKS.md for more details and usage instructions
Pre-commit Hooks
The project uses Git hooks to enforce code quality standards automatically when committing changes.
Setup
Husky is used to manage Git hooks and is automatically installed and configured when you run npm install. No manual setup is required.
Available Hooks
- pre-commit: Runs before each commit to ensure code quality
- Runs Biome.js to check and auto-fix formatting and path alias usage
- Runs TypeScript type checking
- Auto-stages files fixed by Biome.js
Bypassing Hooks
In rare cases, you may need to bypass the pre-commit hooks:
git commit --no-verify -m "Your commit message"
⚠️ Note: Only bypass hooks when absolutely necessary and ensure code quality manually.
Troubleshooting
If the pre-commit hook fails:
- Review the error messages in the console
- Fix the reported issues
- Stage your changes again
- Retry the commit
For hook execution issues:
# Reinstall husky hooks
npm run prepare
Environment Configuration
The project uses an .env file for configuration:
- Application-specific configuration
- Database connection string
- Development server port
- API base URL
- Node environment
Troubleshooting
Database Issues
- Ensure PostgreSQL is running
- Check that your database connection string is correct in
.env - Try resetting the database:
npx prisma migrate reset
Build Issues
- Clear node_modules and reinstall:
Remove-Item -Recurse -Force node_modules; npm install - Check that all environment variables are set correctly
- Ensure you have the correct Node.js version installed
Common Operations
Starting Development Server
npm run dev