A Next.js application for space exploration, citizen science, and data classification.
docker compose up -d db
docker exec -it starsailors_db psql -U postgres
\l
docker compose build flaskapp
docker compose up -d flaskapp
The project includes a comprehensive Docker-based testing infrastructure for consistent, isolated testing across development and CI/CD environments.
Command | Purpose | Environment |
---|---|---|
npm run docker:test:unit |
Fast unit testing | Isolated container |
npm run docker:test:e2e |
E2E testing (headless) | App + test containers |
npm run docker:test:e2e:local |
E2E with user creation | Full test environment |
npm run docker:test:all |
Complete test suite | Unit + E2E combined |
npm run docker:test:clean |
Cleanup resources | Remove containers/volumes |
# Run unit tests in Docker
npm run docker:test:unit
# Run E2E tests in Docker (requires application server)
npm run docker:test:e2e
# Run E2E tests locally (with user creation)
npm run docker:test:e2e:local
# Run all tests (unit + E2E)
npm run docker:test:all
# Clean up Docker resources
npm run docker:test:clean
# Manual build (if needed)
docker-compose -f docker-compose.test.yml build
# Start test application server manually
docker-compose -f docker-compose.test.yml up nextapp-test
The testing environment supports multiple profiles for different testing scenarios:
# Unit tests only - Fast, isolated unit testing
docker-compose -f docker-compose.test.yml --profile unit up
# E2E tests only - Full application integration testing
docker-compose -f docker-compose.test.yml --profile e2e up
# Local E2E tests - Comprehensive testing with user creation
docker-compose -f docker-compose.test.yml --profile local-test up
# All tests - Complete test suite validation
docker-compose -f docker-compose.test.yml --profile all up
# Build with no cache
docker-compose -f docker-compose.test.yml build --no-cache
# Run specific service
docker-compose -f docker-compose.test.yml run --rm unit-tests yarn test:unit --run
# Interactive debugging
docker-compose -f docker-compose.test.yml run --rm unit-tests bash
# Check service status
docker-compose -f docker-compose.test.yml ps
# Follow logs in real-time
docker-compose -f docker-compose.test.yml logs -f
# Clean up containers and networks
docker-compose -f docker-compose.test.yml down --remove-orphans
Specialized Docker image for testing with Cypress dependencies:
- Base: Node.js 22 on Debian Bullseye
- Features: Pre-installed GUI libraries for headless browser testing
- Optimizations: Cypress cache handling, CI-ready environment
- Purpose: Runs both unit tests and E2E tests
Production-ready Docker image for the Next.js application:
- Base: Node.js 22 with optimized layers
- Features: Multi-stage build with production optimizations
- Purpose: Main application container for deployment
File | Purpose | Usage |
---|---|---|
compose.yml |
Development environment | docker-compose up |
docker-compose.test.yml |
Testing environment | docker-compose -f docker-compose.test.yml up |
docker-compose.prod.yml |
Production deployment | docker-compose -f docker-compose.prod.yml up |
# Start development services
docker-compose up -d
# Start with specific services
docker-compose up -d db redis
# View logs
docker-compose logs -f nextapp
# Build and start production environment
docker-compose -f docker-compose.prod.yml up -d
# Scale services
docker-compose -f docker-compose.prod.yml up -d --scale nextapp=3
Multi-service orchestration for comprehensive testing:
- nextapp-test: Test application server (development mode)
- unit-tests: Isolated unit testing service
- e2e-tests-headless: Headless E2E testing
- e2e-tests-local: Local E2E testing with user creation
- all-tests: Combined unit + E2E test execution
Test environment configuration:
NODE_ENV=test
NEXTAUTH_URL=http://localhost:3000
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_PUBLIC_SUPABASE_URL=https://placeholder.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=placeholder_key
SKIP_USER_CREATION_TESTS=true
# 1. Local development with rapid feedback
npm test
# 2. Feature validation with Docker
npm run docker:test:unit
# 3. Pre-commit comprehensive testing
npm run docker:test:all
# 1. Build phase
docker-compose -f docker-compose.test.yml build
# 2. Unit tests (fast feedback)
docker-compose -f docker-compose.test.yml --profile unit up --abort-on-container-exit
# 3. Integration tests (comprehensive validation)
docker-compose -f docker-compose.test.yml --profile e2e up --abort-on-container-exit
# 4. Deployment gate (full test suite)
docker-compose -f docker-compose.test.yml --profile all up --abort-on-container-exit
Service | Purpose | Port | Health Check |
---|---|---|---|
nextapp-test |
Test application server | 3000 | HTTP endpoint |
unit-tests |
Unit testing execution | - | Exit code |
e2e-tests-headless |
Headless E2E testing | - | Service dependency |
e2e-tests-local |
Local E2E with user creation | - | Service dependency |
all-tests |
Combined test suite | - | Sequential execution |
- π Consistency: Same testing environment across all machines
- π‘οΈ Isolation: Tests run in clean containers with controlled dependencies
- β‘ Flexibility: Choose appropriate test scope with profiles
- π Monitoring: Health checks and logging for debugging
- π CI/CD Ready: Optimized for continuous integration pipelines
- π Scalable: Easy parallel execution and cloud deployment
# Clean rebuild if containers are corrupted
docker-compose -f docker-compose.test.yml build --no-cache
# Remove all containers and networks
docker-compose -f docker-compose.test.yml down --remove-orphans --volumes
# Check container resource usage
docker stats
# Inspect container configuration
docker-compose -f docker-compose.test.yml config
# Debug network connectivity
docker-compose -f docker-compose.test.yml exec nextapp-test curl -f http://localhost:3000
# Check Docker daemon status
docker system info
# Clean up unused Docker resources
docker system prune -a
If tests fail due to missing environment variables:
- Verify
.env.test
exists and contains proper values - Check that services are using the correct env_file in docker-compose.test.yml
- Ensure environment variables are properly set in container
# Use BuildKit for faster builds
DOCKER_BUILDKIT=1 docker-compose -f docker-compose.test.yml build
# Run tests in parallel (where supported)
docker-compose -f docker-compose.test.yml up --parallel
# Limit container resources if needed
docker-compose -f docker-compose.test.yml up --scale unit-tests=1
For detailed Docker testing documentation, see DOCKER_TESTING_GUIDE.md
.
The application uses a user-centric component organization based on key user mechanics rather than technical implementation:
src/components/
βββ π classification/ # Image/data classification mechanics
β βββ viewport/ # Analysis viewports & tools
β βββ telescope/ # Telescope classification system
β βββ tools/ # AI classifiers & analysis tools
β
βββ π deployment/ # Structure & mission deployment
β βββ structures/ # Building & managing structures
β βββ equipment/ # Equipment management
β βββ missions/ # Mission planning & execution
β
βββ π discovery/ # Exploration & data discovery
β βββ planets/ # Planet exploration
β βββ anomalies/ # Anomaly discovery
β βββ data-sources/ # Data generators & sources
β βββ weather/ # Weather discovery
β
βββ π¬ research/ # Scientific progression
β βββ projects/ # Research projects
β βββ SkillTree/ # Skill progression system
β
βββ π₯ social/ # Community & sharing features
β βββ comments/ # Commenting system
β βββ posts/ # Post sharing
β βββ activity/ # Social activity feeds
β
βββ π€ profile/ # User management & authentication
β βββ auth/ # Authentication & landing pages
β βββ setup/ # Profile setup & management
β βββ dashboard/ # User dashboard components
β βββ inventory/ # User inventory management
β
βββ π¨ ui/ # Reusable UI components
β βββ icons/ # Custom icons
β βββ scenes/ # 3D scenes & graphics
β βββ helpers/ # UI utilities & helpers
β
βββ π layout/ # Application layout components
βββ π providers/ # React context providers
app/
- Next.js 14 app router with file-based routingapp/api/
- Server-side API routesapp/(routes)/
- Page components and layouts
src/core/
- Core application logic and contextsrc/shared/
- Shared utilities and helper functionslib/
- External library configurationshooks/
- Custom React hookstypes/
- TypeScript type definitions
styles/
- Global CSS and animationspublic/
- Static assets and images
Components are organized by what users do rather than technical implementation:
- Classification: Users analyze images, classify data, use telescopes
- Deployment: Users build structures, manage equipment, plan missions
- Discovery: Users explore planets, find anomalies, discover data
- Research: Users progress scientifically, unlock technologies
- Social: Users comment, share posts, see community activity
- Profile: Users manage accounts, authenticate, track inventory
- Intuitive Navigation: Developers can easily find components by user functionality
- Feature Isolation: Changes to one user mechanic don't affect others
- Reusable UI: Common UI components are properly separated
- Clear Dependencies: Import paths clearly show component relationships
- Easier Testing: Test files can be organized by user feature
- Use absolute imports:
@/src/components/classification/...
- UI components:
@/src/components/ui/...
- Types:
@/types/...
- Utilities:
@/src/shared/...
- Identify the primary user mechanic
- Place in appropriate feature directory
- Use UI components from
@/src/components/ui/
- Follow existing naming conventions
All internal navigation routes have been validated to ensure they point to the correct paths after the reorganization:
- β
Authentication routes: Updated
/login
β/auth
- β
Deployment routes: Updated
/deploy
β/activity/deploy
- β
Planet navigation: Updated
/scenes/planet
β/planets/[id]
with proper dynamic routing - β Build validation: All routes compile successfully and generate proper static/dynamic pages
- Core Pages:
/
,/account
,/auth
,/privacy
,/terms
,/tests
- Research:
/research
,/research/tree
- Discovery:
/planets/[id]
,/planets/clouds/[id]
,/planets/edit/[id]
,/planets/paint/[id]
- Social:
/posts/[id]
,/posts/surveyor/[id]
- Deployment:
/activity/deploy
- Structures:
/structures/balloon
,/structures/cameras
,/structures/seiscam
,/structures/telescope
- Dynamic Structure Routes: Various
[project]
,[id]
, and[mission]
parameters - API Endpoints: Comprehensive gameplay, research, and data upload APIs
All routes maintain backward compatibility while following the new user-centric architecture.