Skip to content
T0mii edited this page Jan 9, 2026 · 5 revisions

Setting Up Nebula For Users

You only need to download the app from the last release on the releases page.

Setting Up Nebula For Devs

Ready to dive in? Awesome. Here is how you get Nebula running on your local machine.

Prerequisites

Before we start, make sure you have:

  1. Flutter SDK (Version 3.10 or higher).
  2. A Supabase Project (Free tier is perfect).

Quick Start

1. Clone the Repo

Get the code on your machine:

git clone https://github.com/TG12r/nebula.git
cd nebula

2. Environment Variables

Nebula needs to talk to the stars (Supabase). Create a .env file in the root of the project:

SUPABASE_URL=your_project_url_here
SUPABASE_ANON_KEY=your_anon_key_here

You can find these keys in your Supabase Dashboard > Project Settings > API.

3. Generate Code

Since we use envied for secure API keys, you need to generate the config files:

dart run build_runner build -d

4. Run it!

Install dependencies and launch:

flutter pub get
flutter run

5. Supabase Database Setup

To make the app work, you need to set up the database structure.

  1. Go to your Supabase Dashboard > SQL Editor.
  2. Click "New Query".
  3. Paste and Run the following SQL to create the tables and security policies:
-- 1. Favorites Table
create table public.favorites (
  id uuid not null default gen_random_uuid (),
  user_id uuid not null references auth.users (id) on delete cascade,
  track_id text not null,
  title text not null,
  artist text not null,
  thumbnail_url text not null,
  duration_seconds integer not null default 0,
  created_at timestamp with time zone not null default now(),
  constraint favorites_pkey primary key (id),
  constraint favorites_user_track_key unique (user_id, track_id)
);

-- RLS for Favorites
alter table public.favorites enable row level security;
create policy "Users can view their own favorites" on public.favorites for select using ((select auth.uid()) = user_id);
create policy "Users can insert their own favorites" on public.favorites for insert with check ((select auth.uid()) = user_id);
create policy "Users can delete their own favorites" on public.favorites for delete using ((select auth.uid()) = user_id);

-- 2. Playlists Table
create table public.playlists (
  id uuid not null default gen_random_uuid (),
  user_id uuid not null references auth.users (id) on delete cascade,
  name text not null,
  created_at timestamp with time zone not null default now(),
  constraint playlists_pkey primary key (id)
);

-- RLS for Playlists
alter table public.playlists enable row level security;
create policy "Users can view their own playlists" on public.playlists for select using ((select auth.uid()) = user_id);
create policy "Users can insert their own playlists" on public.playlists for insert with check ((select auth.uid()) = user_id);
create policy "Users can update their own playlists" on public.playlists for update using ((select auth.uid()) = user_id);
create policy "Users can delete their own playlists" on public.playlists for delete using ((select auth.uid()) = user_id);

-- 3. Playlist Tracks
create table public.playlist_tracks (
  id uuid not null default gen_random_uuid (),
  playlist_id uuid not null references public.playlists (id) on delete cascade,
  track_id text not null,
  title text not null,
  artist text not null,
  thumbnail_url text not null,
  duration_seconds integer not null default 0,
  added_at timestamp with time zone not null default now(),
  constraint playlist_tracks_pkey primary key (id)
);

-- RLS for Playlist Tracks
alter table public.playlist_tracks enable row level security;
create policy "Users can manage tracks in their playlists" on public.playlist_tracks
  for all using ( exists ( select 1 from public.playlists where id = playlist_tracks.playlist_id and user_id = (select auth.uid()) ) );

-- 4. Performance Indexes
create index favorites_user_id_idx on public.favorites (user_id);
create index playlists_user_id_idx on public.playlists (user_id);
create index playlist_tracks_playlist_id_idx on public.playlist_tracks (playlist_id);

Need help? Open an issue in the repo!

Clone this wiki locally