- Node.js 18.18+ (check with
node --version) - npm (comes with Node.js)
- A free Neon Postgres database account
- A GitHub account
git clone https://github.com/YOUR-USERNAME/EcoSphere.git
cd EcoSphere
npm installcp .env.example .envEdit .env with these values:
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
Neon Postgres connection string | Yes |
NEXTAUTH_SECRET |
Run openssl rand -base64 32 to generate |
Yes |
NEXTAUTH_URL |
http://localhost:3000 for local dev |
Yes |
GOOGLE_CLIENT_ID |
Google OAuth client ID | No (leave blank) |
GOOGLE_CLIENT_SECRET |
Google OAuth client secret | No (leave blank) |
npm run db:push # Creates tables from Prisma schema
npm run db:seed # Seeds emission factors + demo orgnpm run devOpen http://localhost:3000.
Once running, navigate to:
/targetsto configure carbon limit reduction targets./settings/factorsto define custom activity intensity coefficients.
Use these credentials to explore the app:
- Email:
demo@ecosphere.dev - Password:
EcoSphereDemo123!
Make sure you've created the .env file from .env.example and filled in the DATABASE_URL with your Neon connection string.
Check that your Neon database is active. Free tier databases may pause after 7 days of inactivity — wake it up by running a query in the Neon console.
Run npx tsc --noEmit to identify type errors. Common issues:
- Missing types in
@types/*packages (runnpm installagain) - Using
anytypes without comments
- Make sure you ran
npm run db:seedto create the demo user - Check that the
NEXTAUTH_SECRETis set correctly - Verify the database connection is working
The Leaflet map uses OpenStreetMap tiles, which require internet access. If you're behind a corporate proxy or firewall, the tiles may not load. This doesn't affect functionality.
- Push your repository to GitHub
- Import the project on Vercel
- Set environment variables in Vercel project settings:
DATABASE_URL: Use the pooled connection string from NeonNEXTAUTH_SECRET: Generate a new secretNEXTAUTH_URL: Set to your Vercel deployment URL (e.g.,https://your-app.vercel.app)
- Deploy
- Apply schema changes to production through your migration workflow before or during deployment. Do not run
db:pushordb:seedagainst production; reserve seeding for local development or staging data.
npm test # Jest unit tests
npm run test:watch # Watch mode
npm run test:e2e # Playwright E2E tests| Script | Purpose |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
npm test |
Run Jest tests |
npm run test:e2e |
Run Playwright tests |
npm run db:push |
Push Prisma schema to database |
npm run db:migrate |
Create a new migration |
npm run db:seed |
Seed database with demo data |
npm run db:studio |
Open Prisma Studio |