This guide will help you upload your sensor API project to GitHub as a private repository.
- Project Name:
sensorapiorsensor-graphql-api - Description: Python GraphQL API for generic sensor data with PostgreSQL backend
- Visibility: Private
- Technologies: Python, FastAPI, Strawberry GraphQL, SQLAlchemy, PostgreSQL, Alembic
-
Go to GitHub: Open https://github.com in your browser
-
Sign in to your GitHub account
-
Create New Repository:
- Click the "+" icon in the top right corner
- Select "New repository"
- Repository name:
sensorapiorsensor-graphql-api - Description:
Python GraphQL API for generic sensor data with PostgreSQL backend - Select "Private" repository
- DO NOT initialize with README, .gitignore, or license (we already have these)
- Click "Create repository"
-
Add Remote and Push:
# Copy the repository URL from GitHub (should look like): # https://github.com/YOUR_USERNAME/sensorapi.git git remote add origin https://github.com/YOUR_USERNAME/sensorapi.git git push -u origin main
-
Install GitHub CLI (if not already installed):
# On Ubuntu/Debian sudo apt update && sudo apt install gh # On macOS brew install gh # On Windows # Download from https://cli.github.com/
-
Authenticate with GitHub:
gh auth login
-
Create and Push Repository:
gh repo create sensorapi --private --source=. --remote=origin --push
Your repository will include:
sensorapi/
├── app/ # Main application package
│ ├── core/ # Core configuration
│ ├── database/ # Database models and connection
│ └── graphql/ # GraphQL schema and resolvers
├── alembic/ # Database migrations
├── scripts/ # Utility scripts
├── requirements.txt # Python dependencies
├── requirements-vercel.txt # Vercel-specific requirements
├── main.py # FastAPI application entry point
├── README.md # Project documentation
├── DEPLOYMENT.md # Deployment instructions
├── GRAPHQL_EXAMPLES.md # GraphQL query examples
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose setup
├── vercel.json # Vercel deployment config
├── .env.example # Environment variables template
├── .env.production.example # Production environment template
└── .gitignore # Git ignore rules
- ✅ FastAPI + Strawberry GraphQL backend
- ✅ PostgreSQL database with SQLAlchemy ORM
- ✅ Alembic database migrations
- ✅ Generic sensor data model (SensorType, Location, Sensor, SensorReading, Alert)
- ✅ Sample data creation script
- ✅ Deployment configurations for Vercel and Azure
- ✅ Docker support with multi-stage builds
- ✅ Comprehensive documentation and examples
- ✅ Environment management with .venv support
-
Set up GitHub Secrets (for CI/CD):
DATABASE_URL: Your PostgreSQL connection stringSECRET_KEY: Your application secret key- Add other environment variables as needed
-
Enable GitHub Actions (optional):
- Create
.github/workflows/directory - Add CI/CD workflows for testing and deployment
- Create
-
Configure Branch Protection (recommended):
- Go to Settings > Branches
- Add protection rules for
mainbranch - Require pull request reviews
- Require status checks
-
Add Collaborators (if needed):
- Go to Settings > Collaborators
- Add team members with appropriate permissions
After uploading to GitHub, others can get started with:
# Clone the repository
git clone https://github.com/YOUR_USERNAME/sensorapi.git
cd sensorapi
# Set up environment
chmod +x setup.sh && ./setup.sh
# Configure environment variables
cp .env.example .env
# Edit .env with your database credentials
# Run database migrations
source .venv/bin/activate
alembic upgrade head
# Create sample data
python scripts/create_sample_data.py
# Start development server
chmod +x dev.sh && ./dev.shFor questions about this project structure or deployment, refer to:
README.md- General project informationDEPLOYMENT.md- Deployment instructionsGRAPHQL_EXAMPLES.md- API usage examples