Atreus is a full-stack AI chat application with conversation history, source-aware answers, and configurable system prompt behavior.
Live URL : Atreus
- Sign in with Google or GitHub
- Start new chats and continue follow-up conversations
- View saved conversation history
- Rename or delete conversations from sidebar
- Get source links for web-backed answers
- Use a customizable system prompt for assistant behavior/instructions
- Stay within daily request limits with visible usage in UI
- Auth with Supabase
- Protected backend endpoints per user
- Conversation and message persistence with Prisma + PostgreSQL
- Conditional Tavily usage (web search only when needed)
- Markdown-rendered assistant answers
- Source panel per answer
- Daily request limiting (persisted in database)
- Optimistic UI transitions with loading states
- Frontend: React 19, Bun, TypeScript, Tailwind CSS
- Backend: Node/Bun runtime, Express, TypeScript
- Database ORM: Prisma
- Database: PostgreSQL (Supabase)
- Auth: Supabase Auth
- AI model API: Google Gemini via
@ai-sdk/google - Web search API: Tavily
- UI libs: Radix primitives + lucide-react + shadcn-style components
- Markdown rendering:
react-markdown,remark-gfm,rehype-raw
- Tavily is constrained and not called for normal conversational prompts
- Daily request usage is stored in DB, not only memory
- Rate limit metadata is returned via headers and rendered in frontend usage UI
- Conversation route changes are optimistic with skeleton loading
- Sign-out and major actions provide immediate visual feedback
- React
StrictModewrapper was removed in app mount to avoid development double-effect confusion for this workflow
- User signs in (Google/GitHub) through Supabase.
- Frontend sends JWT in
Authorization: Bearer <token>. - Backend middleware verifies user token and scopes data by
userId. - For new asks:
- Backend checks daily quota from DB.
- Backend decides whether web search is needed.
- If needed, Tavily results are added into prompt context.
- Gemini streams answer back to frontend.
- Conversation + messages are stored.
- For follow-ups:
- Existing conversation history is used.
- Quota is checked again.
- Frontend renders streamed content, markdown, and sources.
- Usage counters and remaining requests are shown in UI.
System prompt is configurable using environment variables:
SYSTEM_PROMPT: your custom system promptPROMPT_TEMPLATE: prompt template used to inject context and user query
Fallback behavior:
- If
SYSTEM_PROMPTis missing, backend uses a default prompt from source (backend/promt.ts) - If
PROMPT_TEMPLATEis missing, backend uses default template from same file
This allows each developer/team to customize assistant behavior safely without changing core code every time.
git clone https://github.com/pawanshekhawat/Atreus.git
cd Atreuscd backend
bun install
cd ../frontend
bun installCreate backend/.env:
# Required AI + search
GOOGLE_GENERATIVE_AI_API_KEY=your_google_ai_key
TAVILY_API_KEY=your_tavily_key
# Database
DATABASE_URL=your_postgres_pool_url
DIRECT_URL=your_postgres_direct_url
# Supabase
SUPABASE_URL=your_supabase_url
SUPABASE_SECRET_KEY=your_supabase_service_role_key
SUPABASE_PUBLISAHABLE_KEY=your_supabase_publishable_key
# OAuth providers
GOOGLE_CLIENT_ID=your_google_oauth_client_id
GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret
GITHUB_CLIENT_ID=your_github_oauth_client_id
GITHUB_CLIENT_SECRET=your_github_oauth_client_secret
# Prompt config
SYSTEM_PROMPT=your_custom_system_prompt
PROMPT_TEMPLATE=your_custom_prompt_template
# Optional (default is 10)
RATE_LIMIT_MAX_REQUESTS_PER_DAY=10cd backend
bunx prisma generate
bunx prisma migrate deployIf your provider requires direct DB connection for migrations, ensure DATABASE_URL points to direct connection (or set it temporarily to your direct URL).
cd backend
bun index.tscd frontend
bun devFrontend default local URL: http://localhost:3000
Backend default local URL: http://localhost:4000
- Google AI API key (Gemini)
- Tavily API key
- Supabase project (Auth + Postgres)
- Google OAuth app credentials
- GitHub OAuth app credentials
If you use Atreus and have feature ideas, open an issue or discussion.
Contributions are welcome. Please open an issue first for major changes so implementation direction stays aligned.
