Set Up and Deploy Your Asakiri Instance
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.
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
In your Asakiri project directory:
supabase init
supabase link --project-ref YOUR_PROJECT_ID
You can find your project ID in the Supabase dashboard URL or in project settings
supabase db push
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.
You'll need your Supabase URL and anonymous key to connect your frontend. From your Supabase dashboard:
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:
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.
Commit your changes and push your code to GitHub:
git add .
git commit -m "Prepare for deployment"
git push
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.
Install the Netlify adapter for SvelteKit:
npm install @sveltejs/adapter-netlify
Update your svelte.config.js
file:
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
Commit your changes and push your code to GitHub:
git add .
git commit -m "Prepare for Netlify deployment"
git push
After deployment, update the PUBLIC_FRONTEND_URL
environment variable with your
new Netlify site URL.
Now that your frontend is deployed, you need to update your Supabase authentication settings:
https://your-app.vercel.app
)https://your-app.vercel.app/auth/callback
If you later add a custom domain, you'll need to update these URLs in Supabase again.
UPDATE profiles
SET is_admin = true
WHERE email = 'your-email@example.com';
Test your deployment by:
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.
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.
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.
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.
Having trouble deploying your Asakiri instance? Find help through these resources: