A minimal viable backend for a decentralized, Ethereum wallet-authenticated microblogging platform. Users can log in using their wallet, manage profiles, and create posts, likes, and comments — all secured with message signing and JWT-based authentication.
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL
- ORM: TypeORM
- Authentication: Ethereum wallet + message signing (via
ethers.js) + JWT - Package Manager: pnpm
git clone https://github.com/js313/decentralized-social.git
cd decentralized-social/backend
pnpm installCopy .env.example to .env and update the values:
cp .env.example .envIf PostgreSQL isn't already installed, run:
docker run --name social-db -p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=social \
-d postgrespnpm start:devApp runs at: http://localhost:3000
Run this to generate:
pnpm typeorm migration:generate
pnpm typeorm migration:runYou can export a SQL dump with this command:
Copy the postgres DB configs to apps/backend/db/db-config.ts before seeding
pnpm run seed- POST /auth/verify – Verifies a signed message and returns a JWT.
- GET /users/:wallet – Get user profile.
- POST /users – Create or update user (JWT required).
- GET /posts – Get all posts.
- GET /posts/:id – Get single post with comments and likes.
- POST /posts – Create new post (JWT required).
- POST /posts/:id/like – Like a post (JWT required).
- POST /posts/:id/comment – Comment on a post (JWT required).
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Wallet Auth: RainbowKit + wagmi v2
- Web3: ethers.js
- CSS: Tailwind CSS
- Query Management: React Query
- Wallet Login: Message signing + JWT
- Package Manager: pnpm
cd frontend
pnpm installcp .env.example .env.localMake sure backend is running on port 3000
Get a free project ID from WalletConnect Cloud
pnpm devApp runs at: http://localhost:3001
- User clicks "Connect Wallet" (RainbowKit modal appears)
- User signs a challenge message
- Backend verifies the signature and returns a JWT
- JWT is used for authenticated requests (e.g., posting, liking, commenting)
- POST /auth/verify – Verify wallet signature and issue JWT
- GET /users/:wallet – Fetch profile
- POST /users – Create/update profile (JWT)
- GET /posts – All posts
- GET /posts/:id – Single post with comments and likes
- POST /posts – Create post (JWT)
- POST /posts/:id/like – Like post (JWT)
- POST /posts/:id/comment – Comment (JWT)