AI writing assistant API for African professionals — built with Node.js, TypeScript, Prisma, PostgreSQL, and Groq
# Inkr API
> AI writing assistant API for African professionals — built for speed, designed for scale.
**Live API:** inkr-api.onrender.com
**Live App:** inkr-web.vercel.app
**Frontend Repo:** itsxcell/inkr-web
---
## What is Inkr?
Inkr is a backend API powering an AI writing assistant targeted at African professionals. Users can generate business documents — proposals, emails, pitch decks — using large language models, with a credit-based billing system and Stripe payment integration.
This project was built to demonstrate production-grade backend architecture using modern Node.js tooling.
---
## Tech Stack
| Layer | Technology |
|---|---|
| Runtime | Node.js |
| Language | TypeScript |
| Framework | Express.js |
| Database | PostgreSQL (Supabase) |
| ORM | Prisma 7 |
| AI Provider | Groq (llama-3.3-70b-versatile) |
| Auth | JWT + Google OAuth 2.0 |
| Payments | Stripe |
| Deployment | Render |
---
## Architecture
```
src/
├── config/ # Passport OAuth strategy
├── lib/ # Shared infrastructure (Prisma, Groq, Stripe clients)
├── middleware/ # JWT authentication, rate limiting
└── modules/
├── auth/ # Register, login, Google OAuth, /me
├── credits/ # Balance, top-up, transaction history
├── generations/ # AI generation, history
└── stripe/ # Checkout sessions, webhook handler
```
---
## Key Design Decisions
**PostgreSQL over MongoDB** — relational data fits the billing and credits model. ACID guarantees matter when money is involved.
**Abstracted AI provider** — Groq is isolated in `src/lib/groq.ts`. Swapping to OpenAI or Gemini requires changing one file.
**Atomic credit operations** — every credit change runs inside a Prisma transaction. Balance update and transaction log always succeed or fail together.
**Immutable transaction log** — `CreditTransaction` records have no `updatedAt`. An audit trail you can edit is not an audit trail.
**Webhook-driven payments** — credit top …