3.0 KiB
3.0 KiB
TTS Dialect Annotation Platform
A Next.js web application for annotating and managing dialect audio datasets.
Prerequisites
- Node.js 18+
- npm or yarn
Quick Start
1. Install Dependencies
npm install
2. Set Up Environment Variables
Create a .env file in the project root with necessary configuration based on .env.example.
3. Initialize Database
npm run db:generate # Generate migration files (if changes were made to the db)
npm run db:push # Apply migrations to database
4. Run Development Server
npm run dev
Open http://localhost:3000 in your browser.
Project Structure
src/app/- Next.js pages and API routesadmin/- Admin dashboard pagesannotate/- Annotation pages (actual application)user/- User authentication pagesapi/- Different API-Pages for usage in frontend (Download, Upload, User)actions/- Server actions for data operations
src/components/- Reusable React componentssrc/lib/- Utilities, database, and auth configurationdrizzle/- Database migration files
Available Scripts
| Command | Description |
|---|---|
npm run dev |
Start development server (localhost:3000) |
npm run build |
Build for production |
npm run start |
Start production server |
npm run db:generate |
Generate database migrations |
npm run db:push |
Push migrations to database |
Tech Stack
- Framework: Next.js 16
- Auth: Better-Auth
- Database: Drizzle ORM + SQLite
- Styling: Tailwind CSS
- Language: TypeScript
Modifying the Data Model
Steps to Update the Database Schema
-
Edit the Schema
- Open
src/lib/model/and modify the relevant schema files - Export any new tables in
src/lib/model/index.ts
- Open
-
Generate Migration
npm run db:generateThis creates SQL migration files in the
drizzle/directory. -
Review the Migration
- Check the generated SQL file in
drizzle/to ensure correctness - Make manual adjustments if needed
- Check the generated SQL file in
-
Update Server Actions (if needed)
- Update or create server actions in
src/app/actions/to handle the new fields/tables
- Update or create server actions in
Example: Adding a New Field
- Open
src/lib/model/dataset_entry.ts - Add the new column to the schema
- Run
npm run db:generate - Review and run
npm run db:push - Update relevant server actions and components
Admin Signup System
The platform automatically generates a one-time admin token on startup if no admin exists in the database. This token is logged to the console and can only be used once.
Upgrading to Admin Account
- Sign in with your regular account
- Try to access
/admin - You'll see a form asking for the admin token
- Paste the token from the console output
- Click "Admin aktivieren" to upgrade your account
After successful upgrade:
- The token becomes invalid
- Your account gains full admin privileges
- No new token is generated (admin now exists)
- Trying to upgrade another account will fail (token is spent)