Austen is an AI-powered Nextjs application to generate story relationships between book characters using Mermaidjs diagrams.
- ๐ Search and analyze any book from Open Library
- ๐ค AI-powered character relationship analysis
- ๐ Generate Mermaid diagrams
- ๐พ Save, download (SVG, PNG) and manage your generated graphs
- ๐ Share graphs publicly or keep them private
- ๐ Discover public graphs generated by other users
- ๐ค User accounts
A character relationship graph generated for "Sense and Sensibility" by Jane Austen:
%%{
init: {
'theme': 'base',
'themeVariables': {
'primaryColor': '#BB2528',
'primaryTextColor': '#fff',
'primaryBorderColor': '#7C0000',
'lineColor': '#F8B229',
'secondaryColor': '#006100',
'tertiaryColor': '#fff'
}
}
}%%
graph LR
A(Elinor Dashwood) -->|Sister| B([Marianne Dashwood])
A -->|Mother| C([Mrs. Dashwood])
A -->|Love Interest| D([Edward Ferrars])
B -->|Love Interest| E([John Willoughby])
B -->|Admirer| F([Colonel Brandon])
C -->|Stepbrother| G([John Dashwood])
G -->|Wife| H([Fanny Dashwood])
D -->|Fiancรฉe| I([Lucy Steele])
F -->|Guardian| J([Eliza Williams])
-
Clone the repository:
git clone https://github.com/herol3oy/austen.git cd austen -
Install dependencies:
npm i
-
Set up environment variables:
- Copy
.env.local.exampleto.env.local - Fill in the required API keys:
DEEPSEEK_API_KEY=your_deepseek_api_key NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
- Copy
-
Set up Supabase:
-
Create a new Supabase project
-
Enable authentication
-
Run the following SQL statements in your Supabase SQL editor to create the
graphsandprofilestables:create table public.graphs ( id uuid not null, book_name text not null, svg_graph text not null, mermaid_syntax text not null, created_at timestamp with time zone not null default now(), author_name text null, emojis text null, user_id uuid null, is_public boolean null default false, constraint graphs_pkey primary key (id), constraint graphs_user_id_fkey foreign KEY (user_id) references auth.users (id) ) TABLESPACE pg_default; create table public.profiles ( id uuid not null, username text not null, updated_at timestamp with time zone null default now(), constraint profiles_pkey primary key (id), constraint profiles_username_key unique (username), constraint profiles_id_fkey foreign KEY (id) references auth.users (id) on delete CASCADE, constraint username_format check ((username ~ '^[a-zA-Z0-9_]+$'::text)), constraint username_length check ( ( (char_length(username) >= 3) and (char_length(username) <= 20) ) ) ) TABLESPACE pg_default;
-
Set up Row Level Security (RLS) for both tables (see Supabase dashboard for examples on restricting access based on
user_idoris_publicstatus). -
Create a Supabase database function
handle_new_userand a trigger onauth.usersto automatically create a profile entry when a new user signs up. The function should extract the username fromNEW.raw_user_meta_data ->> 'username'.-- Function to create a profile for a new user create function public.handle_new_user() returns trigger language plpgsql security definer set search_path = public as $$ begin insert into public.profiles (id, username) values (new.id, new.raw_user_meta_data->>'username'); return new; end; $$ -- Trigger to call the function after a new user is created create trigger on_auth_user_created after insert on auth.users for each row execute procedure public.handle_new_user();
-
-
Start the development server:
npm run dev
-
Build for production:
npm run build
-
Implement Like/Unlike Functionality for Graphs
- Add like button
- Implement like/unlike API endpoints in Supabase
- Add like count display
-
Load more graphs in the discover page
- Add a button to load more graphs
"Jane Austen Inspired Illustrations", CC-BY 4.0. Quelle: https://colorconfetti.com/culture-history-environment/jane-austen/jane-austen-inspired-illustrations/