This repository provides a unified starting point for building modern Web3 applications using Abstract Wallet, Ethereum-based authentication (SIWE - Sign-In with Ethereum), and on-chain session management.
The solution integrates two independent repositories:
- Frontend: Next.js app integrated with Abstract Wallet.
- Backend: Dockerized Express server with Prisma ORM, JWT auth, SIWE integration, and session management.
| Repository | URL | Description |
|---|---|---|
| Frontend | nextera-abstract (branch: abstract-sessions) | Next.js app integrated with Abstract Wallet. |
| Backend | web3-auth-backend | Dockerized Express API server (SIWE, Prisma, sessions). |
agw-session-fullstack-template/
β£ π README.md (this documentation)
β
β£ π frontend [https://github.com/slkzgm/nextera/tree/abstract-sessions]
β β£ π Next.js app (Abstract, theme management, sessions)
β β π Components, hooks, and API integrations
β
β π backend [Dockerized Express server]
β£ π src (Express, JWT, SIWE handlers, Prisma ORM)
β£ π prisma (schema & migrations)
β£ π Dockerfile (multi-stage Node.js build)
β£ π docker-compose.yml (Postgres & Backend)
β π docker-compose.override.yml (Dev mode overrides)
- Docker & Docker Compose
- Node.js (v18+)
- npm or pnpm
- Abstract Wallet Account
Clone backend repository and enter directory:
git clone https://github.com/slkzgm/express-abstract-sessions backend
cd backendEnvironment Configuration (.env):
Create a .env file in the backend root directory:
NODE_ENV=development
PORT=3000
HOST_PORT=3000
DATABASE_URL="postgresql://postgres:postgres@database:5432/postgres"
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
POSTGRES_HOST_PORT=5432
POSTGRES_PORT=5432
JWT_SECRET="your_jwt_secret"
CHAIN=abstractTestnet
SIWE_DOMAIN="yourdomain.com"
SIWE_STATEMENT="Sign in with Ethereum"
SIWE_URI="https://yourdomain.com"
SIWE_CHAIN_ID=1
NONCE_EXPIRY_MS=300000Development Mode:
docker compose -f docker-compose.yml -f docker-compose.override.yml up --buildThis runs:
- PostgreSQL DB with persistent volume.
- Express backend in dev mode with auto-reload on code changes.
Backend API available at: π http://localhost:3000
Production Mode:
docker compose up --buildProduction mode uses pre-built, optimized code, and migrations applied automatically.
Clone frontend repository and enter directory:
git clone -b abstract-sessions https://github.com/slkzgm/nextera frontend
cd frontend
npm installFrontend Environment (.env.local):
NEXT_PUBLIC_BACKEND_URL="http://localhost:3000"npm run devFrontend app runs at: π http://localhost:3001
If you prefer, you can easily run both services simultaneously using concurrently:
At the project root directory (web3-fullstack-template):
npm install concurrentlyCreate a root package.json with:
{
"scripts": {
"dev": "concurrently \"docker compose -f backend/docker-compose.yml -f backend/docker-compose.override.yml up\" \"npm --prefix frontend run dev\""
}
}Run both frontend and backend together:
npm run dev- Connect wallet via frontend.
- Fetch SIWE challenge (
GET /api/auth/challenge). - Sign challenge using Abstract Wallet.
- Authenticate via backend (
POST /api/auth/login), receiving JWT cookie.
- Initiate a session via backend (
GET /api/session). - Confirm session on-chain (frontend action).
- Confirm session via backend (
POST /api/session/confirm). - Interact securely (e.g., mint NFTs using session API endpoints).
Use JWT-based authorization:
- Example protected route (
GET /api/protected).
Frontend and backend are MIT licensed; please verify individual repositories for specific details.
- Consistency & Isolation: Ensures consistent environment across development, staging, and production.
- Rapid Development: Automatic code reload in dev mode via Docker Compose overrides.
- Production Ready: Multi-stage builds ensure optimized and secure deployment.
---
## β
**Final Considerations:**
- Replace all placeholders (`YOUR_BACKEND_REPO_LINK`, domains, secrets) with your real values.
- Clearly outlines both Dockerized backend and traditional Next.js frontend setup for easy adoption.
- Keeps development independent and simple, aligning perfectly with your preferred approach of separate repository management.