Skip to content

vagxrth/linea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

244 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Linea

Think. Sketch. Design.

Linea is an AI-powered design tool that transforms hand-drawn sketches and wireframes into polished, production-ready designs. It features an infinite canvas for sketching, AI-driven style guide generation from moodboard images, and automatic workflow page creation β€” all within a seamless SaaS experience.

Features

  • Infinite Canvas β€” Draw shapes (rectangles, ellipses, arrows, lines, freehand), add text, pan/zoom, multi-select, group with frames, and auto-save in real time.
  • Wireframe-to-Design β€” Upload or sketch a wireframe, and Linea generates a complete HTML/CSS design using your style guide, with WCAG AA accessibility baked in.
  • Style Guide Generation β€” Upload moodboard images and Linea extracts a full design system: color palette (primary, secondary, UI, utility, status), typography hierarchy, and spacing guidelines.
  • Workflow Pages β€” Automatically generate complementary pages (dashboards, settings, profiles, data tables) that match your primary design's visual language.
  • Inspiration Sidebar β€” Attach reference images that inform the AI during design generation.
  • Project Management β€” Create, rename, delete, and organize projects with auto-save, thumbnails, and public/private sharing.
  • Subscription Billing β€” $10/month plan with 50 AI credits per billing period, powered by Polar.

Tech Stack

Layer Technology
Framework Next.js 15 (App Router, Turbopack)
Frontend React 19, TypeScript 5
Styling Tailwind CSS 4, shadcn/ui (Radix UI)
State Management Redux Toolkit, RTK Query
3D / Landing Three.js, React Three Fiber, Drei
Database Convex (real-time serverless database)
Authentication Convex Auth (email/password + Google OAuth)
AI Google Gemini 2.5 Flash via Vercel AI SDK
Payments Polar ($10/mo subscription + credits)
Background Jobs Inngest (autosave, webhook processing)
Analytics Vercel Analytics
Deployment Vercel

Project Structure

linea/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ page.tsx                  # Landing page (3D gallery)
β”‚   β”‚   β”œβ”€β”€ auth/                     # Sign in / Sign up pages
β”‚   β”‚   β”œβ”€β”€ (protected)/              # Auth-guarded routes
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/            # Projects list
β”‚   β”‚   β”‚   β”‚   └── [session]/        # Workspace
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ canvas/       # Infinite canvas editor
β”‚   β”‚   β”‚   β”‚       └── style-guide/  # Style guide editor
β”‚   β”‚   β”‚   └── billing/              # Subscription management
β”‚   β”‚   └── api/
β”‚   β”‚       β”œβ”€β”€ generate/             # AI generation endpoints
β”‚   β”‚       β”‚   β”œβ”€β”€ route.ts          # Wireframe β†’ design
β”‚   β”‚       β”‚   β”œβ”€β”€ style/            # Moodboard β†’ style guide
β”‚   β”‚       β”‚   └── workflow/         # Complementary page generation
β”‚   β”‚       β”œβ”€β”€ billing/              # Checkout & webhook handlers
β”‚   β”‚       └── inngest/              # Background job serve endpoint
β”‚   β”œβ”€β”€ components/                   # UI components
β”‚   β”‚   β”œβ”€β”€ canvas/                   # Canvas rendering
β”‚   β”‚   β”œβ”€β”€ shapes/                   # Shape components
β”‚   β”‚   β”œβ”€β”€ toolbar/                  # Canvas toolbar
β”‚   β”‚   β”œβ”€β”€ moodboard/                # Moodboard uploads
β”‚   β”‚   └── ui/                       # shadcn/ui primitives
β”‚   β”œβ”€β”€ hooks/                        # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ use-canvas.ts             # Canvas state & interactions
β”‚   β”‚   β”œβ”€β”€ use-project.ts            # Project CRUD
β”‚   β”‚   β”œβ”€β”€ use-styles.ts             # Style guide management
β”‚   β”‚   └── use-subscription.ts       # Entitlement checks
β”‚   β”œβ”€β”€ redux/                        # Redux store, slices, API
β”‚   β”œβ”€β”€ inngest/                      # Background job definitions
β”‚   β”œβ”€β”€ prompts/                      # AI system prompts
β”‚   └── middleware.ts                 # Auth & route protection
β”œβ”€β”€ convex/                           # Convex backend
β”‚   β”œβ”€β”€ schema.ts                     # Database schema
β”‚   β”œβ”€β”€ auth.ts                       # Auth configuration
β”‚   β”œβ”€β”€ user.ts                       # User queries
β”‚   β”œβ”€β”€ projects.ts                   # Project mutations/queries
β”‚   β”œβ”€β”€ subscription.ts               # Credits & subscription logic
β”‚   β”œβ”€β”€ moodboard.ts                  # Moodboard image storage
β”‚   └── inspiration.ts                # Inspiration image storage
└── public/                           # Static assets

Prerequisites

  • Node.js 18+
  • npm (ships with Node)
  • A Convex account β€” convex.dev
  • A Google Cloud project with OAuth 2.0 credentials
  • A Google AI (Gemini) API key β€” ai.google.dev
  • A Polar account for payments β€” polar.sh
  • An Inngest account for background jobs β€” inngest.com

Getting Started

1. Clone the repository

git clone https://github.com/vagxrth/linea.git
cd linea

2. Install dependencies

npm install

3. Set up Convex

npx convex dev

This will prompt you to create a Convex project (or link to an existing one) and start syncing your convex/ backend functions.

4. Configure environment variables

Create a .env.local file in the project root:

# Convex
CONVEX_DEPLOYMENT=<your-convex-deployment>
NEXT_PUBLIC_CONVEX_URL=<your-convex-url>
CONVEX_SITE_URL=http://localhost:3000

# Google OAuth
GOOGLE_CLIENT_ID=<your-google-oauth-client-id>
GOOGLE_CLIENT_SECRET=<your-google-oauth-client-secret>

# Google Gemini AI
GOOGLE_GENERATIVE_AI_API_KEY=<your-gemini-api-key>

# Polar (Payments)
POLAR_ACCESS_TOKEN=<your-polar-access-token>
POLAR_WEBHOOK_SECRET=<your-polar-webhook-secret>
POLAR_PLAN=<your-polar-plan-id>
POLAR_ENV=sandbox

# Inngest (Background Jobs)
INNGEST_SIGNING_KEY=<your-inngest-signing-key>
INNGEST_EVENT_KEY=<your-inngest-event-key>

# App
NEXT_PUBLIC_APP_URL=http://localhost:3000

5. Run the development server

npm run dev

Open http://localhost:3000 to see the app.

6. Run Inngest (optional, for background jobs)

In a separate terminal:

npx inngest-cli@latest dev

This starts the Inngest dev server which connects to your local app at /api/inngest.

Scripts

Command Description
npm run dev Start dev server with Turbopack
npm run build Build for production
npm start Start production server
npm run lint Run ESLint
npx convex dev Start Convex dev sync

Database Schema

Linea uses Convex with the following core tables:

  • users β€” Managed by Convex Auth (email, name, image, OAuth accounts)
  • projects β€” Canvas data, style guides, generated designs, moodboard/inspiration images, thumbnails
  • subscriptions β€” Polar subscription state, credit balance, grant/rollover limits
  • credits_ledger β€” Immutable log of credit grants and consumption with idempotency keys

Authentication

Linea supports two auth methods via Convex Auth:

  • Email/Password β€” Standard sign-up and sign-in forms
  • Google OAuth β€” One-click sign-in with Google

Routes are protected by Next.js middleware:

  • / and /auth/* β€” Public (redirects to dashboard if already signed in)
  • /dashboard/* and /billing/* β€” Protected (redirects to sign-in if not authenticated)
  • /api/auth/*, /api/inngest/*, /api/polar/webhook β€” Bypassed (no auth required)

Billing & Credits

Detail Value
Price $10/month
Credits per period 50
Cost per AI operation 1 credit
Rollover limit 50 credits
Payment provider Polar

Credits are granted on subscription creation and renewal via Inngest webhook processing. Each AI operation (style guide generation, wireframe-to-design, workflow page) consumes 1 credit.

Deployment

Linea is designed to deploy on Vercel:

  1. Push your repo to GitHub.
  2. Import the project in Vercel.
  3. Add all environment variables from .env.local to the Vercel project settings.
  4. Set up a production Convex deployment and update CONVEX_DEPLOYMENT and NEXT_PUBLIC_CONVEX_URL.
  5. Switch POLAR_ENV from sandbox to production and update Polar credentials.
  6. Configure your custom domain and update CONVEX_SITE_URL and NEXT_PUBLIC_APP_URL.
  7. Set up Polar webhook URL pointing to https://yourdomain.com/api/billing/webhook.
  8. Ensure Google OAuth redirect URIs include your production domain.

About

π™π™π™Šπ™ˆ π™‰π˜Όπ™‹π™†π™„π™‰ π˜Ώπ™Šπ™Šπ˜Ώπ™‡π™€π™Ž π™π™Š π˜Ώπ™„π™‚π™„π™π˜Όπ™‡ π™ˆπ˜Όπ™Žπ™π™€π™π™‹π™„π™€π˜Ύπ™€π™Ž.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages