Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PloutusLab/krafta-web/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through running Krafta on your local machine from a fresh clone to a fully functional development environment, including a seeded admin account and a working checkout flow. The entire setup requires only Node.js and npm — no Docker, no external database, and no Supabase credentials for local development.
Krafta includes a local filesystem fallback for all file uploads. When Supabase environment variables are absent or set to placeholder values, design files and payment receipts are saved to public/uploads/ instead of a private Supabase bucket. This means you can explore the full feature set — including the design editor and payment submission flow — without any cloud credentials.
1

Prerequisites and clone

Make sure you have Node.js 18 or later and npm installed. Then clone the repository and move into the project directory:
git clone https://github.com/PloutusLab/krafta-web.git
cd krafta-web
2

Install dependencies

Install all runtime and development dependencies. Krafta uses standard npm conventions and is compatible with yarn and pnpm as well.
npm install
Key packages installed include Next.js 16, React 19, Prisma with the libSQL adapter, Fabric.js, Supabase JS client, Sharp, and Zod.
3

Configure environment variables

Create a .env file at the project root with at minimum the two required variables:
.env
# Required — path to the local SQLite database file
DATABASE_URL="file:./dev.db"

# Required — secret used to sign and verify JWTs
JWT_SECRET="your-secret-key"
To enable Supabase Storage for design files and receipts, add the following optional variables. If they are omitted or left as placeholders, the platform automatically falls back to the local filesystem.
.env
# Optional — Supabase project credentials
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-supabase-anon-key"
Never commit your .env file. The repository’s .gitignore already excludes it.
4

Run database migrations

Krafta uses Prisma to manage the SQLite schema. For a fresh local setup, you have two options:Option A — Full migration history (recommended for development):
npx prisma migrate dev
This applies all existing migrations in prisma/migrations/, generates the Prisma Client, and prompts you to name any new migration if you have edited the schema.Option B — Push schema directly (fastest for a quick first look):
npx prisma db push
This synchronises the current prisma/schema.prisma to the database without creating a migration history entry. It is useful for prototyping but should not be used in production environments.
5

Start the development server

Start the Next.js development server with Turbopack enabled:
npm run dev
Open http://localhost:3000 in your browser. You will see the Krafta storefront homepage with the product catalog, design editor, and creator portal links in the header.
6

Seed an admin user and access the admin panel

Krafta does not ship a seed script by default, so the easiest way to create an admin account is via the register endpoint followed by a manual role update.Step 1 — Register a new account by visiting http://localhost:3000/creator or calling the API directly:
curl -X POST http://localhost:3000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@krafta.local", "password": "adminpass123"}'
This creates a user with the default CLIENTE role.Step 2 — Promote to ADMIN using Prisma Studio:
npx prisma studio
Open http://localhost:5555 in your browser, navigate to the User table, find the record for admin@krafta.local, and change the role field from CLIENTE to ADMIN. Save the record.Alternatively, you can update the role directly with the Prisma CLI:
npx prisma db execute --stdin <<'SQL'
UPDATE "User" SET "role" = 'ADMIN' WHERE "email" = 'admin@krafta.local';
SQL
Step 3 — Log in and visit the admin panel at http://localhost:3000/creator. After signing in with your admin credentials, navigate to http://localhost:3000/admin. The middleware will verify your JWT, confirm the ADMIN role, and grant access.

Next steps

With the server running and an admin account created, you can:
  • Add products and variants from the admin catalog panel at /admin/catalog/create.
  • Open the design editor at /editor and upload a PNG or SVG design file.
  • Complete a test checkout using the Pago Móvil or bank transfer payment flow and approve the submission in /admin/payments.
  • Register a workshop account and view the production dashboard at /workshop/dashboard.

Build docs developers (and LLMs) love