Haibu is a community-driven decentralized social network built on Celestia. Unlike traditional platforms, Haibu operates with a DAO governance model, giving users control over their data, interactions, and the evolution of the platform.
- Learn more about Haibu: https://www.haibusocial.com/
- Haibu's main app: https://app.haibusocial.com/auth/register
- Gamified Governance Token Campaign: https://click.haibusocial.com/
- 🗳️ DAO Governance: Decision-making through $HAI token-based voting.
- 🏆 Gamified Engagement: Earn $HAI tokens by participating in campaigns.
- 💻 Open-Source Development: Contribute, solve issues, and get rewarded.
- 💬 Social Interactions: Post "Hai" (similar to tweets), like, comment, and share content.
- 🔒 Blockchain-Powered Security: Built on Celestia & Chopin Framework for transparency and data integrity.
This is a Node.js backend for a social network, built with Express.js, Prisma, and PostgreSQL. It provides RESTful API endpoints for user authentication, posting content, and interacting with the platform.
/social-network-backend
├── prisma/ # Prisma configuration
│ ├── schema.prisma # Database schema
│ ├── migrations/ # Migrations
│
├── src/
│ ├── config/ # Environment and security settings
│ ├── database/ # Prisma instance setup
│ ├── modules/ # Feature-based modules (users, posts, auth, etc.)
│ ├── middleware/ # Global middleware (error handling, auth)
│ ├── index.ts # Main entry point
│
├── .env # Environment variables
├── package.json # Project configuration
├── tsconfig.json # TypeScript settings
├── Dockerfile # Deployment configuration
├── docker-compose.yml # PostgreSQL container setup
git clone https://github.com/villarley/social-network-backend.git
cd social-network-backend
npm install
Create a .env
file in the root directory and add:
DATABASE_URL="postgresql://user:password@localhost:5432/social_network"
PORT=5000
JWT_SECRET="super_secret_key"
docker-compose up -d
npm run migrate
npm run generate
npm run dev
npm run build
npm start
Command | Description |
---|---|
npm run dev |
Runs the server in development mode with hot reload. |
npm run start |
Starts the server in production mode. |
npm run build |
Compiles TypeScript into JavaScript. |
npm run migrate |
Runs Prisma migrations. |
npm run generate |
Generates Prisma types. |
npm run db-push |
Syncs Prisma schema with the database. |
npm run db-seed |
Seeds the database with initial data. |
npm run lint |
Runs ESLint to check code quality. |
npm run format |
Formats the code using Prettier. |
Method | Endpoint | Description |
---|---|---|
GET |
/api/users |
Fetch all users |
POST |
/api/users |
Create a new user |
Method | Endpoint | Description |
---|---|---|
POST |
/api/auth/login |
Authenticate user and return JWT |
POST |
/api/auth/register |
Register a new user |
Method | Endpoint | Description |
---|---|---|
GET |
/api/posts |
Fetch all posts |
POST |
/api/posts |
Create a new post |
This project can be deployed using Docker:
docker build -t social-network-backend .
docker run -p 5000:5000 social-network-backend
Or deploy via a cloud platform like Heroku, Render, or AWS.
- Villarley - GitHub Profile
This project is licensed under the MIT License - see the LICENSE file for details.