NextBase
Search
⌃K

4. Dev environment

Install dependencies

  1. 1.
    Run yarn
  2. 2.
    Supabase login within your terminal
    1. 1.
      Note: If you haven't used supabase before in the terminal, you will need to login with supabase in the terminal.
    2. 2.
      Create an access token for supabase here https://app.supabase.com/account/tokens
    3. 3.
      Copy the access token and run
    4. 4.
      yarn supabase login
    5. 5.
      It will prompt for an access token. Paste the token there. It should log you in.
  3. 3.
    Run yarn supabase link --project-ref {projectRef} . Your project ref is available in the project settings section within the supabase dashboard.
    1. 1.
      Once you run the command, you will prompted for the database password. Enter the password, you saved earlier.
    2. 2.
      When it completes, your project will be linked to supabase.
  4. 4.
    Run yarn supabase db push . This will push all the nextbase magic into your own supabase project. Teams, admin panel, projects etc will now be ready for use.

Setup env variables

In your repository directory, you should have a .env.local.example file which looks like this. Create a .env.local file right beside it but instead of dummy values like YOUR_SUPABASE_PROJECT_REF, fill the actual details.
  1. 1.
    NEXT_PUBLIC_SUPABASE_URL is available in the project api settings section in supabase. It's called Project Url over there.
  2. 2.
    NEXT_PUBLIC_SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY are also available in the project api settings section in supabase.
  3. 3.
    Setup a Sendgrid / Post mark account and once you do, grab your authorised email sender address and add it to ADMIN_EMAIL. You can do this later if you want. It's not a blocker while developing your app. Same goes for SENDGRID_API_KEY. (If you want to use a different email provider, create a different environment variable here and set the relevant value).
  4. 4.
    The other env variables should be relatively easy to setup.
SUPABASE_PROJECT_REF=YOUR_SUPABASE_PROJECT_REF
NEXT_PUBLIC_SUPABASE_URL=YOUR_NEXT_PUBLIC_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_NEXT_PUBLIC_SUPABASE_ANON_KEY
STRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=YOUR_NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
SUPABASE_SERVICE_ROLE_KEY=YOUR_SUPABASE_SERVICE_ROLE_KEY
SUPABASE_JWT_SECRET=YOUR_SUPABASE_JWT_SECRET
SENDGRID_API_KEY=YOUR_SENDGRID_API_KEY
STRIPE_WEBHOOK_SECRET=YOUR_STRIPE_WEBHOOK_SECRET
ADMIN_EMAIL=YOUR_ADMIN_EMAIL

Run your dev server

We are ready to start our dev server. Run
yarn dev
Our local development server is now running at localhost:3000.
Arni Creative Private Limited @2023