Modern, open-source invoice generation platform built with Next.js, tRPC, and TypeScript.
- Node.js: Version 20 or higher
- Yarn: Version 4.9.1 or higher (automatically managed via
packageManagerfield) - PostgreSQL: Database for storing application data
-
Clone the repository
git clone https://github.com/legions-developer/invoicely.git cd invoicely -
Install dependencies
yarn install
-
Set up environment variables
# Create environment file in root directory cp .env.example .env # Create symlinks for environment variables across apps yarn sys-link
-
Set up the database
# Generate database schema yarn db:generate # Run database migrations yarn db:migrate
-
Start development server
yarn dev
- Next.js 15.3.1 - React framework with App Router
- React 19 - UI library
- TypeScript 5.8.2 - Type-safe JavaScript
- tRPC 11.1.2 - End-to-end type-safe APIs
- TanStack Query 5.76.1 - Server state management
- Jotai 2.12.3 - Atomic state management
- Zod 3.25.7 - Schema validation
- Tailwind CSS 4 - Utility-first CSS framework
- Radix UI - Headless UI components
- Shadcn/ui - Re-usable components built on Radix
- Lucide React - Icon library
- Motion 12.10.5 - Animation library
- Next Themes - Theme management
- Drizzle ORM 0.43.1 - Type-safe database ORM
- Neon Database - Serverless PostgreSQL
- Better Auth 1.2.8 - Modern authentication library
- Google OAuth - Social authentication
- Cloudflare R2 - Object storage
- React PDF 9.2.1 - PDF generation
- Turbo 2.5.3 - Monorepo build system
- ESLint 9 - Code linting
- Prettier 3.5.3 - Code formatting
- Husky 9.1.7 - Git hooks
- PostHog - Product analytics
- OpenPanel - Privacy-focused analytics
- React Scan - Performance debugging
- Date-fns 4.1.0 - Date manipulation
- Lodash 4.17.21 - Utility functions
- Decimal.js 10.5.0 - Arbitrary precision decimal arithmetic
- UUID 11.1.0 - Unique identifier generation
invoicely/
βββ apps/
β βββ web/ # Next.js web application
β βββ src/
β β βββ app/ # App Router pages
β β βββ components/ # Reusable UI components
β β βββ constants/ # Application constants
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility libraries
β β βββ providers/ # Context providers
β β βββ trpc/ # tRPC configuration
β β βββ types/ # TypeScript type definitions
β β βββ zod-schemas/ # Zod validation schemas
β βββ public/ # Static assets
β βββ package.json # App dependencies
β
βββ packages/
β βββ db/ # Database package
β β βββ src/
β β β βββ schema/ # Drizzle database schemas
β β β βββ index.ts # Database exports
β β βββ migrations/ # Database migration files
β β
β βββ utilities/ # Shared utilities
β β βββ src/
β β βββ env/ # Environment configuration
β β
β βββ eslint-config/ # Shared ESLint configuration
β βββ typescript-config/ # Shared TypeScript configuration
β
βββ env-links.sh # Environment symlink script
βββ turbo.json # Turbo configuration
βββ package.json # Root package configuration
βββ yarn.lock # Dependency lock file
Create a .env file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/invoicely"
# Authentication
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:3000"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# Cloudflare R2 Storage
CF_R2_ENDPOINT="your-r2-endpoint"
CF_R2_ACCESS_KEY_ID="your-access-key"
CF_R2_SECRET_ACCESS_KEY="your-secret-key"
CF_R2_BUCKET_NAME="your-bucket-name"
CF_R2_PUBLIC_DOMAIN="your-public-domain"
# Analytics
NEXT_PUBLIC_POSTHOG_HOST="your-posthog-host"
NEXT_PUBLIC_POSTHOG_KEY="your-posthog-key"
# Public URLs
NEXT_PUBLIC_BASE_URL="http://localhost:3000"
NEXT_PUBLIC_TRPC_BASE_URL="http://localhost:3000/api/trpc"The project uses a symlink-based approach for environment management:
- Run
yarn sys-linkto create symlinks from the root.envfile to all apps - This ensures consistent environment variables across the monorepo
- Environment variables are validated using
@t3-oss/env-nextjsand Zod
yarn dev # Start development servers for all apps
yarn build # Build all apps for production
yarn start # Start production servers
yarn lint # Lint all packages
yarn lint:fix # Fix linting issues
yarn format # Format code with Prettier
yarn check-types # Type check all packages
# Database Operations
yarn db:generate # Generate database schema
yarn db:migrate # Run database migrations
yarn db:push # Push schema changes to database
yarn db:studio # Open Drizzle Studio
# Utility Scripts
yarn sys-link # Create environment symlinks
yarn reset-repo # Clean all build artifactsyarn dev # Start Next.js development server
yarn build # Build for production
yarn start # Start production server
yarn lint # Lint the web app- Directories: Use lowercase with dashes (e.g.,
components/auth-wizard) - Components: Use PascalCase for component files (e.g.,
UserProfile.tsx) - Client Components: Add
.client.tsxsuffix for components using"use client" - Utilities: Use camelCase for utility files (e.g.,
formatCurrency.ts)
- Variables: Use camelCase (e.g.,
userName,isLoading,hasError) - Constants: Use SCREAMING_SNAKE_CASE (e.g.,
R2_PUBLIC_URL,TOAST_OPTIONS) - Functions: Use camelCase with descriptive verbs (e.g.,
createInvoice,validateEmail) - Booleans: Prefix with auxiliary verbs (e.g.,
isLoading,hasPermission,canEdit)
- Interfaces: Use PascalCase (e.g.,
UserProfile,InvoiceData) - Zod Schemas: Prefix with "Zod" (e.g.,
ZodInvoiceSchema,ZodUserSchema) - Type Exports: Use named exports, avoid default exports
- Use the
functionkeyword for pure functions - Prefer named exports over default exports
- Use functional and declarative programming patterns
- Structure files: exported component, subcomponents, helpers, static content, types
We welcome contributions to Invoicely! Please follow these guidelines:
- Format:
profilename/featurename - Examples:
john/add-dark-mode,sarah/fix-invoice-validation
- PR Title Format:
type: descriptionfeature: add invoice templatesfix: resolve authentication redirect issuechore: update dependencies
- Fork the repository
- Create a feature branch following the naming convention
- Make your changes following the code style guidelines
- Test your changes thoroughly
- Submit a pull request with a descriptive title and description
- Do NOT push database migrations - Migrations should be reviewed and managed by maintainers
- Ensure all tests pass before submitting
- Follow the existing code style and conventions
- Update documentation for any new features
- All PRs require review from at least one maintainer
- Ensure your code follows TypeScript best practices
- Write meaningful commit messages
- Keep PRs focused and atomic
This project is licensed under the MIT License - see the LICENSE file for details.