A premium manga/manhwa reading platform with Supabase Authentication and Discord Role Integration.
Live URL: https://crystal-comics.vercel.app
To ensure the Authentication works correctly and the Discord Bot works, follow these exact steps.
- Create Project: Go to Supabase and create a new project.
- Get API Keys:
- Settings -> API.
- Copy
Project URLandanon publickey. - Add them to your Vercel Environment Variables (or local
.env).
- Setup Discord Auth Provider:
- Go to Authentication -> Providers -> Discord.
- Enable Discord.
- Copy the Callback URL (e.g.,
https://your-ref.supabase.co/auth/v1/callback). - Go to Discord Developer Portal -> Select App -> OAuth2.
- Add Redirect: Paste the Callback URL.
- Copy Client ID and Client Secret from Discord back to Supabase.
- 🛑 URL Configuration (The Most Important Step):
- Go to Supabase -> Authentication -> URL Configuration.
- Site URL: Set this to
https://crystal-comics.vercel.app. - Redirect URLs: Add the following explicitly:
https://crystal-comics.vercel.app/https://crystal-comics.vercel.app/**http://localhost:5173(Keep this for local testing)
- If you do not do this, Supabase will default to localhost and break your production login.
Your Discord Server ID: 1449337912503046178
Invite Link: https://discord.gg/73ttFzMMSd
This app uses Serverless Edge Functions for paid tiers and a Node.js Bot for auto-roles.
- Bot Permissions:
- Discord Dev Portal -> Bot.
- Enable "Server Members Intent" (Required for detecting new members).
- Go to OAuth2 -> URL Generator.
- Scopes:
bot. - Permissions:
Manage Roles. - Important: Invite the bot to your server.
- Server Hierarchy (Crucial):
- In Discord Server Settings -> Roles.
- Drag the "Crystal Bot" role ABOVE the roles you want it to assign (e.g., above "Member", "Knight", "Sovereign").
- If the bot is below the role, it will fail with a 403 Forbidden error.
- Deploy Function (For Subscriptions):
supabase functions deploy discord-role-syncsupabase secrets set DISCORD_BOT_TOKEN=your_token_here
- Update Config (For Subscriptions):
- Open
services/discordConfig.ts. - Action Required: Replace
"ROLE_ID_HERE"with real Role IDs. - How to get IDs: Enable Developer Mode in Discord (User Settings -> Advanced), then Right Click a Role -> Copy ID.
- Open
To automatically give people a role (e.g., "Member") when they join:
- Create a
.envfile in the root folder. - Add your Bot Token:
DISCORD_BOT_TOKEN=your_token_here - Add the Basic Role ID:
DISCORD_BASIC_ROLE_ID=123456789...(Copy this ID from Discord). - Run:
npm run bot
# Install dependencies
npm install
# Run locally
npm run devVITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key
DISCORD_BOT_TOKEN=your_bot_token
DISCORD_BASIC_ROLE_ID=your_role_id_for_new_membersBot fails to assign role? Check Phase 2, Step 2. The Bot's role MUST be visually higher in the list than the role it is trying to give.
"Privileged Intent" Error? Go to Discord Developer Portal -> Bot -> Toggle "Server Members Intent" to ON.