AI-powered tax code generation workflow using Gemini. Generates tax codes, CSVs, and tax reports for any country through a 4-step guided process.
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Auth: Supabase Auth (Google OAuth)
- Database: Supabase (Postgres)
- AI: Google Gemini API (gemini-2.5-flash)
- Styling: Tailwind CSS 3.4 with Axolotl dark theme
- State: Zustand
- Package Manager: pnpm
pnpm installCreate .env.local:
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
GEMINI_API_KEY=your-gemini-api-key
- Enable Google OAuth in the Supabase dashboard under Authentication > Providers
- Database tables and RLS policies are managed via Supabase migrations
pnpm dev # Development server
pnpm build # Production build
pnpm start # Production serverEach country goes through a sequential workflow:
- Tax Codes — Generates a comprehensive list of tax codes for the country
- Tax Code CSV — Converts the tax codes into structured CSV format
- Tax Report — Analyzes the tax codes and produces a detailed report
- Mapped CSV — Combines tax codes with report insights into a final CSV
Each step streams its output from Gemini in real-time. Steps must be completed in order — each step's output is injected into the next step's prompt via {{previous_output}}.
Visit /admin to edit the prompt templates for each step. Available placeholders:
{{country_name}}— The selected country name{{previous_output}}— Output from the previous step
Steps 2 and 4 produce CSV output. A download button appears when these steps complete.
src/
app/
page.tsx # Main page (country selector, steps, chat)
actions.ts # signOut server action
actions/
countries.ts # Country CRUD server actions
steps.ts # Step message/reset server actions
admin/
page.tsx # Prompt template editor
actions.ts # Prompt template server actions
api/gemini/
route.ts # Gemini SSE streaming endpoint
auth/callback/
route.ts # OAuth callback
login/
page.tsx # Login page
components/
chat/
ChatWindow.tsx # Main chat pane with blob background
ChatMessage.tsx # Message bubble (user/assistant)
LoadingIndicator.tsx # Braille spinners + animated line
useChatStore.ts # Zustand store
useChatStream.ts # SSE streaming hook
country/
CountrySelector.tsx # Country dropdown + create
steps/
StepNavigation.tsx # Step tabs with status badges
lib/supabase/
client.ts # Browser Supabase client
server.ts # Server Supabase client
middleware.ts # Auth guard
styles/
globals.css # Tailwind + blob animations
themes/ # Axolotl design tokens
| Table | Purpose |
|---|---|
countries |
User's countries (RLS per user) |
country_steps |
4 steps per country with status + output |
step_messages |
Chat message history per step |
prompt_templates |
Editable prompts for each step |