Prerequisites
Before you begin, ensure you have the following installed:- Node.js 20.x or higher
- npm, yarn, or pnpm package manager
- Git for cloning the repository
This guide covers local development setup. For production deployment, see the Deployment guide.
Installation steps
Install dependencies
Install the required packages using your preferred package manager:
Key dependencies
The application uses the following core packages:Configure environment variables
Set up the database
Run the database migration to create the required tables:This executes the migration script:
Database schema
The migration creates the following tables:The schema uses SQLite with foreign key constraints enabled for data integrity.
Start the development server
Run the development server:The application will be available at http://localhost:3000.
Available scripts
Project structure
Understanding the project layout:Turso database client
The application uses Turso (edge-hosted SQLite) for data storage:Authentication setup
The application uses NextAuth.js v5 with credential and OAuth support:Troubleshooting
Database connection errors
Database connection errors
If you encounter Turso connection errors:
- Verify your
TURSO_DATABASE_URLis correct - Ensure your
TURSO_AUTH_TOKENis valid and not expired - Check that your database exists:
turso db list - Test the connection:
turso db shell invoice-generator
Module not found errors
Module not found errors
If you see “Module not found” errors:
- Delete
node_modulesand lock files: - Clear npm cache:
- Reinstall dependencies:
Port already in use
Port already in use
If port 3000 is already in use:
- Kill the process using port 3000:
- Or run on a different port:
Environment variables not loading
Environment variables not loading
Ensure your
.env.local file:- Is in the project root directory
- Has no syntax errors (no spaces around
=) - Contains all required variables
- Restart the dev server after changes
Next steps
Quick start guide
Create your first invoice
Configuration
Customize the application settings
API reference
Explore the API endpoints
Deployment
Deploy to production