Create an app

FFDB CLI can scaffold a new app from an interactive template flow. It asks for a project name, the runtime platform, the app template, offline support, Tailwind, and optional .env values for your FFDB API URL and admin token.

Start the flow

ffdb-cli init

Why use init instead of manual setup

ffdb-cli init is not just a file copier. It applies runtime-appropriate defaults and wiring so your first app already matches FFDB client expectations.

  • Name
    Correct runtime env keys
    Description

    Writes VITE_FFDB_API_URL, NEXT_PUBLIC_FFDB_API_URL, or EXPO_PUBLIC_FFDB_API_URL automatically.

  • Name
    Template + overlay compatibility
    Description

    Chooses compatible template/overlay combinations for platform and framework.

  • Name
    Faster first success
    Description

    Reduces setup mismatches that usually happen in handwritten bootstraps.

The command guides you through these decisions:

  • Name
    Project name
    Type
    string
    Description

    The output directory for the generated app.

  • Name
    Platform
    Type
    web | electron | expo
    Description

    Choose the runtime you want to scaffold.

  • Name
    Template
    Type
    vite-react | nextjs | vite-vanilla-ts
    Description

    Web apps can use Vite + React, Next.js, or Vite + vanilla TypeScript. Electron apps can use the Vite templates.

  • Name
    Offline support
    Type
    boolean
    Description

    Adds the offline overlay for sql.js, better-sqlite3, or expo-sqlite depending on the platform.

  • Name
    Tailwind CSS
    Type
    boolean
    Description

    Available for web and Electron projects.

  • Name
    FFDB env setup
    Type
    boolean
    Description

    Writes the app API URL and FFDB_AUTH_TOKEN into .env when enabled.

Template matrix

  • Name
    Web + Vite + React
    Description

    Good default for a standard React app with the FFDB client.

  • Name
    Web + Next.js
    Description

    Best when you want server rendering or a Next.js app router project.

  • Name
    Electron + Vite + React
    Description

    Best for desktop apps that should run with a browser UI and local access.

  • Name
    Electron + Vite + Vanilla TS
    Description

    Use this when you want a lighter desktop starter without React.

  • Name
    Expo / React Native
    Description

    Best for mobile apps. The CLI chooses the Expo-specific env key automatically.

How to choose quickly

  1. Choose Next.js when SEO/SSR and App Router conventions matter.
  2. Choose Vite + React for fast client-heavy apps and simpler hosting.
  3. Choose Electron when desktop packaging and local-first UX are priorities.
  4. Choose Expo when mobile runtime and native-device behavior matter.

Environment keys

The CLI writes the correct API URL key for the chosen runtime:

  • Name
    VITE_FFDB_API_URL
    Type
    string
    Description

    Used by Vite web apps.

  • Name
    NEXT_PUBLIC_FFDB_API_URL
    Type
    string
    Description

    Used by Next.js apps.

  • Name
    EXPO_PUBLIC_FFDB_API_URL
    Type
    string
    Description

    Used by Expo apps.

  • Name
    FFDB_AUTH_TOKEN
    Type
    string
    Description

    The admin token written into .env when you opt into env setup.

Generated output

When the command finishes, it prints the next steps for the new app. The important ones are usually:

cd my-ffdb-app
npm install
npm run ffdb:types
npm run dev

If you skipped env setup, the command tells you to copy .env.example to .env before generating types.

Typical generated workflow contract

After initialization, most app templates converge to the same first-run sequence:

  1. Install dependencies.
  2. Generate FFDB types.
  3. Start the development server.

This consistency makes it easier to switch between frameworks without relearning FFDB fundamentals.

Notes

The exact files generated by each template are implementation details. What matters to most developers is the platform, the template family, the offline option, Tailwind, and the env keys written into .env.

Was this page helpful?