A NestJS backend for a Solana meme coin trading platform similar to "Baggs".
- Authentication System: JWT-based authentication with registration and login
- User Management: User profiles with Solana wallet integration
- Database: PostgreSQL with Supabase integration
- Security: Password hashing with bcrypt, input validation
- Error Handling: Global exception filters and validation
- Framework: NestJS with TypeScript
- Database: PostgreSQL (Supabase)
- ORM: TypeORM
- Authentication: JWT tokens with Passport.js
- Validation: class-validator and class-transformer
- Password Hashing: bcrypt
-
Install dependencies:
npm install
-
Environment Configuration:
- Copy
config.example
to.env
- Fill in your Supabase credentials and other configuration
- Copy
-
Database Setup:
- Create a Supabase project
- Get your database URL and API keys
- Update the
.env
file with your credentials
-
Run the application:
# Development npm run start:dev # Production build npm run build npm run start:prod
POST /api/auth/register
- User registrationPOST /api/auth/login
- User loginGET /api/auth/profile
- Get user profile (protected)GET /api/auth/validate
- Validate JWT token (protected)
POST /api/auth/register
Content-Type: application/json
{
"email": "[email protected]",
"username": "trader123",
"password": "SecurePass123!",
"firstName": "John",
"lastName": "Doe",
"solanaWalletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
}
POST /api/auth/login
Content-Type: application/json
{
"usernameOrEmail": "trader123",
"password": "SecurePass123!"
}
{
"user": {
"id": "uuid",
"email": "[email protected]",
"username": "trader123",
"firstName": "John",
"lastName": "Doe",
"solanaWalletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"balance": 0,
"isActive": true,
"isEmailVerified": false,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
},
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/mememint
SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=7d
# Application Configuration
PORT=3000
NODE_ENV=development
id
(UUID, Primary Key)email
(String, Unique)username
(String, Unique)password
(String, Hashed)firstName
(String, Optional)lastName
(String, Optional)solanaWalletAddress
(String, Optional)balance
(Decimal, Default: 0)isActive
(Boolean, Default: true)isEmailVerified
(Boolean, Default: false)createdAt
(Timestamp)updatedAt
(Timestamp)
- Password strength validation
- JWT token-based authentication
- Password hashing with bcrypt (12 rounds)
- Input validation and sanitization
- CORS configuration
- Global exception handling
# Watch mode
npm run start:dev
# Debug mode
npm run start:debug
# Run tests
npm run test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:cov
This backend provides the foundation for a meme coin trading platform. You can extend it with:
- Solana blockchain integration
- Token creation and trading endpoints
- Real-time WebSocket connections
- Email verification system
- Admin panel
- Rate limiting
- Logging system
- API documentation with Swagger
This project is licensed under the UNLICENSED License.