feat: Implement core API endpoints, database schema, ActivityPub federation, and initial user interface for the application.

This commit is contained in:
Christopher
2026-01-22 02:44:46 -08:00
parent 537fc5e8c2
commit b76e586bbc
62 changed files with 9447 additions and 115 deletions
+95 -23
View File
@@ -1,36 +1,108 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
# Project Synapsis
## Getting Started
An open-source, federated social network designed as global communication infrastructure.
First, run the development server:
## Features
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
- **Federation**: ActivityPub-compatible, interoperable with Mastodon and other fediverse platforms
- **Global Identity**: Portable identity backed by DIDs - your handle works everywhere
- **Easy Deployment**: Deploy to Vercel with one click, no Docker or complex setup required
- **Modern UX**: Clean, Vercel-inspired dark theme with responsive design
- **Transparent Feeds**: Chronological and curated feeds with clear algorithms
- **Moderation**: Admin dashboard for reports, post removals, and user actions
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Quick Start
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
### Prerequisites
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
- Node.js 18+
- A Neon PostgreSQL database (free tier available at https://neon.tech)
- An Upstash Redis database (free tier available at https://upstash.com)
## Learn More
### Setup
To learn more about Next.js, take a look at the following resources:
1. Clone the repository:
```bash
git clone https://github.com/your-username/synapsis.git
cd synapsis
```
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
2. Install dependencies:
```bash
npm install
```
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
3. Copy the environment example and configure:
```bash
cp .env.example .env
```
## Deploy on Vercel
4. Update `.env` with your database credentials:
```
DATABASE_URL=postgresql://...
UPSTASH_REDIS_REST_URL=https://...
UPSTASH_REDIS_REST_TOKEN=...
AUTH_SECRET=generate-a-random-string
NEXT_PUBLIC_NODE_DOMAIN=your-domain.com
NEXT_PUBLIC_NODE_NAME=My Synapsis Node
ADMIN_EMAILS=comma,separated,emails
```
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
5. Run database migrations:
```bash
npm run db:push
```
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
6. Start the development server:
```bash
npm run dev
```
### Deploy to Vercel
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/your-username/synapsis)
1. Click the button above
2. Connect your Neon PostgreSQL and Upstash Redis
3. Configure environment variables
4. Deploy!
## Architecture
- **Frontend**: Next.js 14+ with App Router
- **Backend**: Next.js API Routes (serverless)
- **Database**: PostgreSQL via Neon
- **Cache**: Redis via Upstash
- **Federation**: ActivityPub protocol
## API Endpoints
### Authentication
- `POST /api/auth/register` - Create account
- `POST /api/auth/login` - Login
- `POST /api/auth/logout` - Logout
- `GET /api/auth/me` - Get current user
### Posts
- `POST /api/posts` - Create a post
- `GET /api/posts` - Get feed
- `POST /api/posts/[id]/like` - Like a post
- `DELETE /api/posts/[id]/like` - Unlike a post
- `POST /api/posts/[id]/repost` - Repost
### Federation
- `GET /.well-known/webfinger` - WebFinger discovery
- `GET /.well-known/nodeinfo` - NodeInfo discovery
- `GET /nodeinfo/2.1` - Node metadata
- `GET /.well-known/synapsis-handles` - Handle registry export
- `POST /api/federation/handles` - Ingest handle registry from peers
- `POST /api/federation/gossip` - Pull registry from peer nodes (admin)
- `GET /api/handles/resolve` - Resolve handle to DID
### Installation
- `GET /install` - Setup wizard
- `GET /api/install/status` - Installation status
## License
Apache 2.0 License - see LICENSE file for details.