Development Setup
This guide will set you up with a local development environment for Onlook. This involves a Next.js app, a Supabase backend, and the ability to run dev containers with Codesandbox.
Note: This guide is for development and contributing to Onlook. For deploying Onlook for production use, see Self-Hosting.
Prerequisites
These are the prerequisites for setting up Onlook development environment.
- Bun - Enables running the monorepo
- Docker - Enables running the Supabase backend
- Node – Minimum version
v20.16.0
or latest
Setup
1. Clone the repository
git clone https://github.com/onlook-dev/onlook.git
cd onlook
bun install
2. Run backend
Make sure you have Docker running from the instructions above.
bun backend:start
Grab the anon key
and service role key
from the output. We'll use these in the environment setup step.
3. Get API keys
a. Get Codesandbox API key
- Go to Codesandbox Dashboard
- Click on settings in the left menu, your workspace setting should open
- Navigate to the "API" tab
- Click "Create API Token" and generate an API token
- Copy the token and save it for the environment setup step
Note: We plan on enabling running the dev containers with Docker Desktop in the future after we figure out the best API integration.
b. Get OpenRouter API key
Request an API key from OpenRouter. This is used for chatting with your project. https://openrouter.ai/settings/keys
c. Get Fast Apply API key
For applying AI code, SOTA is to use fast apply models in order to resolve the code change. There are two options for Fast Apply providers:
You only need to get one of the keys and set it in the environment variables in later steps.
4. Set environment variables
Run the interactive environment setup script:
bun run setup:env
Note: If you'd prefer manually setting up the environment variables, see the appendix for instructions.
5. Initialize the database
Set up the database schema. You will need to run this command every time there's a change to the database schema.
Note: If prompted for interaction such as choosing an option, cd into packages/db
and run bun run db:push
to use interactive mode.
bun db:push
6. Seed the database with test data
Seed the database with test data. This will create test users and projects.
bun db:seed
7. Run development server
bun dev
Go to http://localhost:3000 to see the app running. You're all set for development!
What's Next?
Now that you have Onlook running locally, explore these resources to make your first contribution or learn more about the architecture. Understanding how Onlook works will help you contribute more effectively to this visual editor for React and TailwindCSS.