A Next.js web application that generates AI-written, formatted university assignments for University of Lahore students. Fill in your student details, describe the topic, and download a ready-to-submit .docx file in seconds.
- AI-generated content — Uses Google Gemini to write a structured, academic assignment body (Introduction, topic-specific body sections, Conclusion).
- Formatted DOCX output — Downloads a
.docxfile with a branded cover page (UoL logo, student info) and well-structured body content. - Flexible word count — Choose a target of 500, 800, 1000, or 1500 words.
- Optional assignment title — Displayed as a heading on the cover page.
- Rate limiting — 5 requests per IP per hour, backed by Upstash Redis.
- Stateless & private — No accounts, no database. API keys stay on the server.
| Layer | Technology |
|---|---|
| Framework | Next.js 14 (App Router) |
| Language | TypeScript |
| Styling | Tailwind CSS |
| AI | Google Gemini (@google/generative-ai) |
| DOCX generation | docx |
| Rate limiting | Upstash Ratelimit + Redis |
- Node.js 18+
- A Google Gemini API key
- An Upstash Redis database (for rate limiting)
-
Clone the repository
git clone https://github.com/Legharihasham/Assasin.git cd Assasin -
Install dependencies
npm install
-
Configure environment variables
Create a
.env.localfile in the project root:GEMINI_API_KEY=your_google_gemini_api_key UPSTASH_REDIS_REST_URL=https://your-upstash-redis-url UPSTASH_REDIS_REST_TOKEN=your_upstash_redis_token # Optional: override the default Gemini model (default: gemini-2.5-flash) # GEMINI_MODEL=gemini-2.5-flash
-
Start the development server
npm run dev
Open http://localhost:3000 in your browser.
- Fill in your student details: name, SAP ID (8 digits), section, and teacher name.
- Enter the subject and assignment number.
- Optionally provide an assignment title (shown as a heading on the cover page).
- Select the word count target (500 / 800 / 1000 / 1500 words).
- Describe the assignment topic or paste the instructions in the text area.
- Click Generate & download DOCX — the file downloads automatically once ready.
Note: AI can make mistakes. Review the generated content before submitting.
| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Build for production |
npm start |
Start the production server |
npm run lint |
Run ESLint |
├── app/
│ ├── api/generate/route.ts # POST /api/generate — validates input, calls Gemini, returns DOCX
│ ├── page.tsx # Main UI (form + download logic)
│ ├── layout.tsx # Root layout
│ └── globals.css # Global styles
├── lib/
│ ├── gemini.ts # Gemini AI integration & JSON parser
│ ├── docx-builder.ts # DOCX file builder (cover page + body)
│ ├── rate-limit.ts # Upstash rate limiter (5 req / 1 h / IP)
│ └── uol-logo-b64.ts # Base64-encoded UoL logo for the cover page
├── scripts/ # Utility scripts for logo extraction
└── next.config.mjs
Each IP address is limited to 3 requests per hour. If you exceed the limit, you will see an error message and need to wait before generating again.
See LICENSE for details.