Akari Art connects to five external services — Google OAuth, MongoDB, Cloudinary, Cloudflare Workers AI, and NextAuth.js session management — each of which requires its own set of credentials. None of these values are bundled with the source code; they are read exclusively from environment variables at runtime. This page explains exactly where to find or generate each credential and how to place it in yourDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/Akari-Art/llms.txt
Use this file to discover all available pages before exploring further.
.env.local file.
Service Configuration
Google OAuth — GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET
Google OAuth — GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET
NextAuth.js uses these credentials to authenticate users via Google’s OAuth 2.0 flow. On successful sign-in, user information (name, email, profile image) is stored in MongoDB.
- Open the Google Cloud Console and create a new project (or select an existing one).
- Go to APIs & Services → OAuth consent screen, choose External, and fill in the required app name and support email fields. Save and continue through each section.
- Go to APIs & Services → Credentials and click + Create Credentials → OAuth 2.0 Client ID.
- Set the Application type to Web application.
- Under Authorized redirect URIs, add:
If you later deploy to production, add your production URI here as well (e.g.,
https://yourdomain.com/api/auth/callback/google). - Click Create. Copy the Client ID and Client Secret into your
.env.localfile:
NextAuth Secret — NEXTAUTH_SECRET and NEXTAUTH_URL
NextAuth Secret — NEXTAUTH_SECRET and NEXTAUTH_URL
NEXTAUTH_SECRET is used by NextAuth.js to sign and encrypt JWT session tokens. It must be a cryptographically secure random string. NEXTAUTH_URL tells NextAuth.js the canonical URL of your deployment.Generate a secure secret with one of the following commands:NEXTAUTH_URL to match your live domain (e.g., https://akari-art.vercel.app).MongoDB — MONGODB_URL
MongoDB — MONGODB_URL
Akari Art uses Mongoose to persist user accounts and image metadata. The application expects a standard MongoDB connection string in
MONGODB_URL.Using MongoDB Atlas (recommended):- Create a free cluster at mongodb.com/cloud/atlas.
- Under Database Access, create a database user with read/write permissions.
- Under Network Access, allow connections from your IP (or
0.0.0.0/0for development). - Click Connect → Drivers and copy the connection string. It will look like:
- Replace
<user>and<pass>with your database user credentials and set:
dbConnect helper in lib/database.ts caches the connection across serverless function invocations using a module-level cache with a maxPoolSize of 10, so you will not exhaust connections during development.Cloudinary — CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET
Cloudinary — CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET
Cloudinary stores every image generated by Akari Art. The Next.js config already allows the
res.cloudinary.com domain in next.config.ts so that images render in <Image> components without any extra setup.- Sign up or log in at cloudinary.com.
- From your Cloudinary dashboard, navigate to the Settings → API Keys panel (or look at the Dashboard home — all three values are displayed there).
- Note down your Cloud name, API Key, and API Secret.
- Add them to
.env.local:
lib/cloudinary.ts module calls cloudinary.config() with these values at import time, so they must be present before the server starts.Cloudflare Workers AI — CLOUDFLARE_ID and CLOUDFLARE_API_KEY
Cloudflare Workers AI — CLOUDFLARE_ID and CLOUDFLARE_API_KEY
Akari Art calls the Cloudflare Workers AI REST API directly from the Finding your Account ID:
/api/image-generation route using the endpoint:- Log in to the Cloudflare dashboard.
- Select any domain (or the Workers & Pages section). Your Account ID is displayed in the right-hand sidebar on the Overview page.
- Go to My Profile → API Tokens → Create Token.
- Use the Create Custom Token option.
- Under Permissions, add Account → Workers AI → Edit (or Read if you only need inference).
- Click Continue to Summary → Create Token and copy the token value — it is only shown once.
Complete .env.local Example
Create this file in the root of your cloned repository. All 11 variables are required — the application will throw at startup if MONGODB_URL is missing, and requests to generate images will fail if the Cloudflare or Cloudinary credentials are absent.
.env.local
Environment Variable Reference
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLIENT_ID | ✅ Yes | OAuth 2.0 Client ID from Google Cloud Console |
GOOGLE_CLIENT_SECRET | ✅ Yes | OAuth 2.0 Client Secret from Google Cloud Console |
NEXTAUTH_SECRET | ✅ Yes | Random secret used to sign and encrypt JWT session tokens |
NEXTAUTH_URL | ✅ Yes | Canonical URL of the app (e.g., http://localhost:3000) |
MONGODB_URL | ✅ Yes | MongoDB connection string; app throws on startup if missing |
CLOUDINARY_CLOUD_NAME | ✅ Yes | Your Cloudinary account’s cloud name |
CLOUDINARY_API_KEY | ✅ Yes | Cloudinary API key for uploading generated images |
CLOUDINARY_API_SECRET | ✅ Yes | Cloudinary API secret (server-side only, never exposed to the browser) |
CLOUDFLARE_ID | ✅ Yes | Cloudflare Account ID used to build the Workers AI API URL |
CLOUDFLARE_API_KEY | ✅ Yes | Cloudflare API token with Workers AI Run permission |
NEXT_PUBLIC_BASE_URL | ✅ Yes | Public base URL used for client-side absolute URL construction |