Deployment Guide

Set Up and Deploy Your Asakiri Instance

Getting Started

Asakiri is a modern language learning platform that combines a SvelteKit frontend with Supabase backend services. This guide will walk you through setting up your own instance, starting with database configuration and then deploying the frontend to your preferred cloud provider.

Requirements

  • GitHub Account: To store and deploy your code
  • Supabase Account: For database, storage, and authentication
  • Vercel or Netlify Account: For frontend hosting
  • Node.js & npm: For local development

1. Supabase Database Setup

Create a Supabase Project

  1. Go to Supabase and sign in
  2. Create a new project by clicking "New Project"
  3. Give your project a name and set a secure database password
  4. Select a region closest to your users
  5. Wait for your project to be created (this may take a few minutes)

Set Up Supabase CLI

The Supabase CLI is the easiest way to apply database migrations:

npm install -g supabase

Once installed, log in to your Supabase account:

supabase login

Initialize Database Migrations

In your Asakiri project directory:

  1. Link your project:
    supabase init
    supabase link --project-ref YOUR_PROJECT_ID

    You can find your project ID in the Supabase dashboard URL or in project settings

  2. Apply migrations:
    supabase db push

What's Happening?

This command applies all database migrations from your project's supabase/migrations directory. It sets up all necessary tables, functions, triggers, and RLS policies for Asakiri to function properly.

Configure Authentication

  1. In your Supabase dashboard, go to Authentication → Providers
  2. Ensure Email provider is enabled
  3. Optionally, set up OAuth providers (Google, GitHub, etc.) if you want to support social logins
  4. Go to Authentication → URL Configuration
  5. Leave the Site URL field blank for now (we'll return to this after deploying the frontend)

Get Supabase Credentials

You'll need your Supabase URL and anonymous key to connect your frontend. From your Supabase dashboard:

  1. Go to Project Settings → API
  2. Copy the "Project URL" and "anon public" key
  3. Keep these values handy for the frontend deployment step

2. Frontend Deployment Options

Vercel

  • Native SvelteKit support
  • Simplified environment variable management
  • Automatic preview deployments
  • Edge function support

Netlify

  • Simple GitHub integration
  • Built-in form handling
  • Easy rollbacks
  • Serverless function support

3a. Deploying to Vercel

Prepare Your Project

First, ensure your project is ready for Vercel deployment by installing the Vercel adapter:

npm install @sveltejs/adapter-vercel

Update your svelte.config.js file:

Configure Environment Variables

Create a .env file in your project root with your Supabase credentials:

PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co
PUBLIC_SUPABASE_ANON_KEY=your-anon-key
PUBLIC_FRONTEND_URL=http://localhost:5173 # Will update after deployment

Make sure to add .env to your .gitignore file to keep your credentials secure.

Push to GitHub

Commit your changes and push your code to GitHub:

git add .
git commit -m "Prepare for deployment"
git push

Deploy on Vercel

  1. Go to Vercel and sign in with GitHub
  2. Click on "Add New" → "Project"
  3. Find and select your Asakiri repository
  4. In the Configure Project section, add these environment variables:
    PUBLIC_SUPABASE_URL https://your-project-id.supabase.co
    PUBLIC_SUPABASE_ANON_KEY your-supabase-anon-key
    PUBLIC_FRONTEND_URL You'll add this after deployment
  5. Click "Deploy"

Update Environment Variables

After deployment, you'll get a URL for your site (e.g., https://your-app.vercel.app). Update the PUBLIC_FRONTEND_URL in your Vercel project settings with this URL.

3b. Deploying to Netlify

Prepare Your Project

Install the Netlify adapter for SvelteKit:

npm install @sveltejs/adapter-netlify

Update your svelte.config.js file:

Add netlify.toml Configuration

Create a netlify.toml file in the root of your project:

[build]
  command = "npm run build"
  publish = "build"

[dev]
  command = "npm run dev"
  port = 5173

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

Push to GitHub

Commit your changes and push your code to GitHub:

git add .
git commit -m "Prepare for Netlify deployment"
git push

Deploy on Netlify

  1. Go to Netlify and sign in with GitHub
  2. Click "Add new site" → "Import an existing project"
  3. Connect to GitHub and select your repository
  4. Add these environment variables:
    PUBLIC_SUPABASE_URL https://your-project-id.supabase.co
    PUBLIC_SUPABASE_ANON_KEY your-supabase-anon-key
    PUBLIC_FRONTEND_URL You'll add this after deployment
  5. Click "Deploy site"

Update Environment Variables

After deployment, update the PUBLIC_FRONTEND_URL environment variable with your new Netlify site URL.

4. Finishing Setup

Configure Supabase Auth URL

Now that your frontend is deployed, you need to update your Supabase authentication settings:

  1. Go to your Supabase dashboard → Authentication → URL Configuration
  2. Set Site URL to your deployment URL (e.g., https://your-app.vercel.app)
  3. Add a redirect URL: https://your-app.vercel.app/auth/callback
  4. Save your changes

Important

If you later add a custom domain, you'll need to update these URLs in Supabase again.

Create Admin User

  1. Visit your deployed application and register a new user
  2. Go to Supabase → SQL Editor
  3. Run the following SQL to make your user an admin (replace the email with yours):
    UPDATE profiles
    SET is_admin = true
    WHERE email = 'your-email@example.com';

Verify Deployment

Test your deployment by:

  1. Signing in with your admin account
  2. Creating a test course
  3. Testing authentication flows (register, login, password reset)
  4. Verifying that database operations work correctly

Common Issues & Solutions

Authentication Errors

Problem: Users can't log in or receive redirect errors.

Solution: Check that your Supabase Site URL and redirect URLs match your deployment URL exactly. Verify that PUBLIC_FRONTEND_URL is correctly set.

Database Migration Failures

Problem: supabase db push command fails with errors.

Solution: Check your migration files for syntax errors. Verify your Supabase CLI is correctly linked to your project. For a fresh start, you can reset your database in the Supabase dashboard and try again.

Missing Environment Variables

Problem: Application errors related to undefined variables.

Solution: Double-check all environment variables are set correctly in your deployment platform. Remember that local environment variables are not automatically transferred to production.

Build Failures

Problem: Deployment fails during the build process.

Solution: Check build logs for specific errors. Common issues include missing dependencies, incorrect adapter configuration, or TypeScript errors.

Next Steps

Now that your Asakiri instance is deployed, you can start configuring and customizing it:

Create Courses

Start building your language learning content by creating courses, units, and lessons.

Go to Courses

Configure Federation

Connect with other Asakiri instances to share courses across platforms.

Federation Settings

Invite Teachers

Grow your platform by inviting language experts to create content.

Manage Users

Need Help?

Having trouble deploying your Asakiri instance? Find help through these resources: