Add full project files
This commit is contained in:
@@ -1,36 +1,172 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# xBid — VFX Quoting & Bidding SaaS
|
||||
|
||||
## Getting Started
|
||||
A professional full-stack VFX quoting application built with **Next.js 15**, **TypeScript**, **Tailwind CSS v4**, **Prisma ORM**, and **PostgreSQL**.
|
||||
|
||||
First, run the development server:
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **Clients** — manage client companies with full contact and billing info
|
||||
- **Jobs / Quotes** — versioned quote documents with status workflow (Draft ? Sent ? Approved/Rejected)
|
||||
- **Shots** — VFX shot breakdown with complexity multipliers and drag-and-drop reordering
|
||||
- **Assets** — CG asset budget tracking (characters, environments, vehicles, etc.)
|
||||
- **Line Items** — per-task cost rows with hours/days/artists/rates, markup, discount, tax
|
||||
- **Rate Cards** — studio rate card library organized by department
|
||||
- **PDF Export** — professional quote PDF with front page + detailed appendix
|
||||
- **Decimal Precision** — all financials use `decimal.js` (no floating-point drift)
|
||||
|
||||
---
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Layer | Technology |
|
||||
|---|---|
|
||||
| Framework | Next.js 15 (App Router, Server Actions) |
|
||||
| Language | TypeScript |
|
||||
| Styling | Tailwind CSS v4 + shadcn/ui |
|
||||
| ORM | Prisma 7 + PostgreSQL 16 |
|
||||
| Forms | React Hook Form + Zod |
|
||||
| Drag & Drop | @dnd-kit/core + @dnd-kit/sortable |
|
||||
| Finance Math | decimal.js |
|
||||
| Notifications | sonner |
|
||||
| PDF | HTML render via `/api/pdf/[id]` |
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 20+
|
||||
- PostgreSQL 16 (or Docker)
|
||||
- npm 10+
|
||||
- `ts-node` for seeding: `npm install -g ts-node typescript`
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Clone & install
|
||||
|
||||
```bash
|
||||
git clone <repo-url>
|
||||
cd xBid
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Configure environment
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Edit `.env`:
|
||||
|
||||
```env
|
||||
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/xbid"
|
||||
NEXTAUTH_SECRET="your-random-secret-here"
|
||||
NEXTAUTH_URL="http://localhost:3000"
|
||||
```
|
||||
|
||||
### 3. Start PostgreSQL
|
||||
|
||||
**Option A — Docker (recommended):**
|
||||
|
||||
```bash
|
||||
docker compose up -d postgres
|
||||
```
|
||||
|
||||
**Option B — local PostgreSQL:**
|
||||
|
||||
```sql
|
||||
CREATE DATABASE xbid;
|
||||
```
|
||||
|
||||
### 4. Run database migrations
|
||||
|
||||
```bash
|
||||
npm run db:generate # generate Prisma client
|
||||
npm run db:migrate # run migrations (enter "init" as migration name)
|
||||
```
|
||||
|
||||
### 5. Seed sample data
|
||||
|
||||
```bash
|
||||
npm run db:seed
|
||||
```
|
||||
|
||||
This creates 15 rate cards, 2 sample clients, 2 jobs with shots, assets, and line items.
|
||||
|
||||
### 6. Start development server
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
Open http://localhost:3000
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
---
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
## Production (Docker)
|
||||
|
||||
## Learn More
|
||||
```bash
|
||||
docker compose up --build -d
|
||||
```
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
After first run, apply migrations:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
```bash
|
||||
docker compose exec app npx prisma migrate deploy
|
||||
docker compose exec app npx prisma db seed
|
||||
```
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
---
|
||||
|
||||
## Deploy on Vercel
|
||||
## PDF Export
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
Navigate to any job and click **Download PDF**. The route at `/api/pdf/[id]` generates HTML with:
|
||||
- **Front page**: client info, project details, shot/asset summary, financial totals, T&C
|
||||
- **Appendix**: full per-shot and per-asset line item breakdown
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
Print to PDF via browser (Ctrl+P ? Save as PDF).
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
app/ Next.js App Router pages
|
||||
api/pdf/[id]/ PDF generation endpoint
|
||||
clients/ Client management
|
||||
jobs/ Job management
|
||||
rate-cards/ Rate card management
|
||||
actions/ Server actions (CRUD)
|
||||
components/
|
||||
assets/ Asset editor
|
||||
clients/ Client form & table
|
||||
dashboard/ Stats & recent jobs
|
||||
jobs/ Job form, table, detail, totals
|
||||
layout/ Sidebar navigation
|
||||
line-items/ Line item table & dialog
|
||||
rate-cards/ Rate card management
|
||||
shots/ Shot editor
|
||||
ui/ shadcn/ui components
|
||||
lib/
|
||||
calculations.ts Decimal.js financial math
|
||||
constants.ts Domain constants & defaults
|
||||
prisma.ts Prisma client singleton
|
||||
validations.ts Zod schemas
|
||||
prisma/
|
||||
schema.prisma Full database schema
|
||||
seed.ts Sample data seeder
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Database Scripts
|
||||
|
||||
```bash
|
||||
npm run db:generate # npx prisma generate
|
||||
npm run db:migrate # npx prisma migrate dev
|
||||
npm run db:seed # ts-node prisma/seed.ts
|
||||
npm run db:studio # npx prisma studio (DB GUI at :5555)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user