A comprehensive social media management platform with multi-agent AI architecture, supporting 9+ platforms with enterprise-grade security and multi-tenant architecture.
- Multi-Tenant Architecture: Complete tenant isolation with PostgreSQL Row-Level Security (RLS)
- JWT Authentication: Secure authentication with tenant_id claims
- AWS S3 Integration: Media storage with CloudFront CDN support
- Redis Caching: High-performance caching and job queuing with BullMQ
- Multi-Platform Support: Ready for Instagram, Twitter, LinkedIn, Facebook, TikTok, YouTube, Pinterest, Threads, and Reddit
- Enterprise Security: Encrypted OAuth tokens, RBAC, and audit trails
- Backend: Node.js with NestJS framework
- Database: PostgreSQL 15+ with Row-Level Security
- Cache/Queue: Redis 7+ with Bull queues
- Storage: AWS S3 + CloudFront CDN
- Authentication: JWT with Passport.js
- Row-Level Security (RLS) for complete data isolation
- Tenant-scoped JWT tokens
- Per-tenant AI budget tracking
- Scalable from single to enterprise deployments
- Node.js 18+
- PostgreSQL 15+
- Redis 7+
- AWS Account (for S3 storage)
- Docker & Docker Compose (optional)
-
Clone the repository
git clone <repository-url> cd ai-social-media-platform
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration -
Start PostgreSQL and Redis
# Using Docker Compose (recommended) docker-compose up postgres redis -d # Or install locally and start services
-
Run database migrations
npm run migration:run
-
Start the development server
npm run start:dev
-
Start all services
docker-compose up -d
-
Run migrations
docker-compose exec app npm run migration:run
| Variable | Description | Default |
|---|---|---|
NODE_ENV |
Environment mode | development |
PORT |
Application port | 3001 |
DB_HOST |
PostgreSQL host | localhost |
DB_PORT |
PostgreSQL port | 5432 |
DB_USERNAME |
Database username | postgres |
DB_PASSWORD |
Database password | password |
DB_NAME |
Database name | ai_social_platform |
REDIS_HOST |
Redis host | localhost |
REDIS_PORT |
Redis port | 6379 |
JWT_SECRET |
JWT signing secret | Required |
AWS_ACCESS_KEY_ID |
AWS access key | Required |
AWS_SECRET_ACCESS_KEY |
AWS secret key | Required |
AWS_S3_BUCKET_NAME |
S3 bucket name | Required |
AWS_CLOUDFRONT_DOMAIN |
CloudFront domain | Optional |
The application uses PostgreSQL with Row-Level Security for multi-tenant isolation:
-- Enable RLS on tenant-specific tables
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
ALTER TABLE social_accounts ENABLE ROW LEVEL SECURITY;
-- Create tenant isolation policies
CREATE POLICY tenant_isolation_users ON users
USING (tenant_id = current_setting('app.current_tenant_id')::uuid);POST /api/v1/auth/register- Register new tenant and admin userPOST /api/v1/auth/login- Login with email/passwordGET /api/v1/auth/profile- Get current user profilePOST /api/v1/auth/refresh- Refresh JWT token
GET /api/v1/tenants- List tenants (admin only)GET /api/v1/tenants/:id- Get tenant detailsPATCH /api/v1/tenants/:id- Update tenant settings
GET /api/v1/users- List tenant usersPOST /api/v1/users- Create new userGET /api/v1/users/:id- Get user detailsPATCH /api/v1/users/:id- Update userDELETE /api/v1/users/:id- Delete user
POST /api/v1/media/upload- Upload media filePOST /api/v1/media/upload/:folder- Upload to specific folderDELETE /api/v1/media/:key- Delete media file
# Run unit tests
npm run test
# Run tests with coverage
npm run test:cov
# Run e2e tests
npm run test:e2enpm run build
npm run start:proddocker-compose --profile production up -dThe application is designed for AWS deployment:
- Compute: ECS with Fargate or EC2
- Database: RDS PostgreSQL with Multi-AZ
- Cache: ElastiCache Redis
- Storage: S3 with CloudFront
- Load Balancer: Application Load Balancer
- Multi-Tenant Isolation: PostgreSQL RLS ensures complete data separation
- Encrypted Storage: OAuth tokens encrypted at rest with AES-256
- JWT Security: Tokens include tenant_id claims for authorization
- Input Validation: Comprehensive validation with class-validator
- Rate Limiting: Built-in rate limiting per tenant/endpoint
- CORS Protection: Configurable CORS policies
GET /api/v1/health- Application health status- Docker health checks included
- Database connection monitoring
- Structured JSON logging
- Request/response logging
- Error tracking with stack traces
- Performance metrics
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review the API endpoints
Next Steps: This foundation supports the implementation of AI agents, social media integrations, and advanced features as defined in the project specifications.