The official backend server for Missile Wars, developed by longtimeno-c.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). This means:
- ✅ You can view and fork this code
- ✅ You can use this code for personal projects
- ✅ You can modify the code
- ❌ You cannot use this code in closed-source commercial projects
- ❗ Any modifications or usage of this code must be made open source
- ❗ You must include the original license and copyright notice
For the full license text, see LICENSE
Copyright (c) 2024 longtimeno-c. All rights reserved.
- Real-time game state management using WebSockets (Middle Earth Library)
- Secure authentication system
- Push notifications via Firebase and expo notifications
- Email notification system
- Database integration with Prisma
- Node.js (v16.x or higher)
- npm (v8.x or higher)
- PostgreSQL database
- Firebase account for notifications and real time messaging
- SMTP server access for emails
Create an .env file in the root directory:
# Server Configuration
NODE_ENV="development"
JWT_SECRET="your-secure-secret-here" # Generate a secure random string
VERBOSE_MODE="ON"
DISABLE_AUTH="OFF"
PORT=3000
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_SECURE=false
EMAIL_USER="your-email@domain.com"
EMAIL_PASS="your-app-specific-password"
EMAIL_FROM="noreply@yourdomain.com"
# WebSocket Configuration (Middle Earth)
WS_PORT=3001
WS_HEARTBEAT_INTERVAL=30000- Create a Firebase project at Firebase Console
- Download your Firebase service account credentials
- Rename the credentials file to
firebasecred.jsonand place it in the project root - This enables real-time push notifications for android devices, profile picture storage and secure firebase authenticaiton / account management.
npm installnpm run devnpm run build
npm start- AWS CLI installed and configured
- EB CLI installed (
pip install awsebcli)
eb initFollow the prompts to select your region, application name, and platform.
eb create [environment-name]Creates a new Elastic Beanstalk environment. Replace [environment-name] with your desired environment name (e.g., production, staging).
Elastic Beanstalk does not automatically upload your local .env file. Set variables on the environment instead.
# Set variables manually
eb setenv KEY=value OTHER=valuegit add -f .env# Verify and select an environment
eb list
eb use your-env-name
eb printenv --environment your-env-nameImportant: Build the application locally before deploying:
npm run buildThis ensures the dist/ directory is created and included in the deployment bundle. The dist/ folder contains the compiled JavaScript files and is not ignored in version control.
eb deploy --stagedDeploys your backend code to the active Elastic Beanstalk environment.
eb statusDisplays the current status of your Elastic Beanstalk environment.
eb logsRetrieves and displays the logs from your Elastic Beanstalk environment.
eb listLists all environments for the current application.
eb use [environment-name]Switches to a different environment as the active deployment target.
eb terminate [environment-name]Terminates the specified Elastic Beanstalk environment. Use with caution as this will delete the environment and all associated resources.
eb openOpens the URL of your Elastic Beanstalk application in your default web browser.
# Pull current database schema
npx prisma db pull
# Generate Prisma Client
npx prisma generate
# Open Prisma Studio (GUI database editor)
npx prisma studio# Create a new migration
npx prisma migrate dev --create-only
# Apply migration
npx prisma migrate devnpx ts-node export-script.ts- Update your
.envfile with new database credentials - Update schema if necessary
- Run import script:
npx ts-node import-script.tsPlease read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
For support, please open an issue in the GitHub repository or contact me on X.
- Middle Earth Library
- Firebase
- Prisma Team
- Expo Team