Storx is designed to be deployed on Vercel with three external services: Neon for serverless PostgreSQL, Clerk for authentication, and ImageKit for CDN file storage. This guide walks through provisioning each service, wiring up the required environment variables, and running your first production deployment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/Storx/llms.txt
Use this file to discover all available pages before exploring further.
Create a Neon database
- Go to neon.tech and sign in or create a free account.
- Click New Project, give it a name (e.g.
storx-production), and select a region closest to your Vercel deployment region. - Once the project is created, open the Connection Details panel and copy the Connection String. It looks like:
- This value becomes your
DATABASE_URLenvironment variable.
Set up Clerk
- Go to clerk.com and sign in or create a free account.
- Click Create application, name it (e.g.
Storx), and choose your desired sign-in methods (email/password, Google, GitHub, etc.). - In the Clerk dashboard, navigate to API Keys and copy:
- Publishable key →
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY - Secret key →
CLERK_SECRET_KEY
- Publishable key →
- In Paths (under Configure → Paths), set the following redirect URLs to match the Next.js App Router pages:
- Sign-in URL:
/signin - Sign-up URL:
/signup - After sign-in URL:
/dashboard - After sign-up URL:
/dashboard
- Sign-in URL:
- Set the corresponding environment variables:
Configure ImageKit
- Go to imagekit.io and sign in or create a free account.
- From the Dashboard, navigate to Developer Options → API Keys.
- Copy the following three values:
- Public Key →
NEXT_PUBLIC_IMAGEKIT_PUBLIC_KEY - Private Key →
IMAGEKIT_PRIVATE_KEY - URL Endpoint →
NEXT_PUBLIC_IMAGEKIT_URL_ENDPOINT(e.g.https://ik.imagekit.io/your_imagekit_id)
- Public Key →
- Storx automatically creates the folder structure
/storex/{userId}/inside ImageKit when the first file is uploaded by each user. No manual folder creation is required.
Deploy to Vercel
- Push your Storx repository to GitHub (or fork github.com/nayalsaurav/Storx).
- Go to vercel.com, click Add New → Project, and import your GitHub repository.
- In the Environment Variables section of the Vercel project settings, add all of the following variables before deploying:
- Click Deploy. Vercel will run
next buildand produce an optimized production bundle. - Once the deployment succeeds, note your production URL (e.g.
https://storx.vercel.app). - Return to your Clerk dashboard and add your production domain to the Allowed origins and update any redirect URLs to use the production URL.
Run migrations
After the first deploy, run the Drizzle migrations locally pointed at your production Neon A successful run prints:The
DATABASE_URL. This creates the files table in your production database.Update your local .env.local with the production DATABASE_URL, then run:files table is now ready to accept records from your production Storx instance.Production Checklist
Environment variables set
Environment variables set
Confirm all eight environment variables are configured in your Vercel project settings before deploying:
| Variable | Source |
|---|---|
DATABASE_URL | Neon project → Connection Details |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Clerk dashboard → API Keys |
CLERK_SECRET_KEY | Clerk dashboard → API Keys |
NEXT_PUBLIC_CLERK_SIGN_IN_URL | Set to /signin |
NEXT_PUBLIC_CLERK_SIGN_UP_URL | Set to /signup |
NEXT_PUBLIC_IMAGEKIT_PUBLIC_KEY | ImageKit dashboard → Developer Options |
IMAGEKIT_PRIVATE_KEY | ImageKit dashboard → Developer Options |
NEXT_PUBLIC_IMAGEKIT_URL_ENDPOINT | ImageKit dashboard → Developer Options |
Database migrations run
Database migrations run
Verify that the The
files table exists in your Neon database before your first user signs in. You can confirm this by opening Drizzle Studio against your production database:files table should be present in the public schema with the following columns: id, name, size, type, file_url, thumbnail_url, imagekit_file_id, user_id, parent_id, is_folder, is_starred, is_trash, created_at, updated_at.The migration history is tracked in the __drizzle_migration table in the public schema.Clerk redirect URLs configured
Clerk redirect URLs configured
In the Clerk dashboard under Configure → Paths, confirm the following URLs are set correctly for your production deployment:
Also ensure your production domain (e.g.
| Setting | Value |
|---|---|
| Sign-in URL | /signin |
| Sign-up URL | /signup |
| After sign-in redirect URL | /dashboard |
| After sign-up redirect URL | /dashboard |
https://storx.vercel.app) is listed under Allowed origins in your Clerk application settings to prevent CORS issues with Clerk’s authentication requests.ImageKit folder structure
ImageKit folder structure
Storx stores all uploaded files under a per-user folder structure in ImageKit. When a file is uploaded to the root of a user’s drive, it is placed at:When a file is uploaded inside a folder, it is nested under:These paths are constructed automatically by the upload API route (
/api/files/upload) using the authenticated Clerk userId and the parentId from the request. No manual configuration in ImageKit is required — the folders are created on first upload. Ensure your ImageKit account has sufficient storage for the expected number of users and file sizes.