This document provides detailed instructions on how to set up and run the Core Web project, including information about all services, their ports, and how to start them.
The Core Web project is a comprehensive web platform built with Rust that includes multiple services and components:
Before running the project, ensure you have the following installed:
| Service | Port | Description |
|---|---|---|
| Main Web Server (HTTP/1.1, HTTP/2) | 8080 | Primary application server with REST API endpoints |
| Main Web Server (HTTP/3) | 4433 | HTTP/3 server (when enabled with feature flag) |
| Metrics Server | 8081 | Prometheus metrics endpoint |
| MySQL Database | 3306 | Primary relational database |
| Redis | 6379 | In-memory data structure store |
| MongoDB | 27017 | Document-based database |
| ClickHouse | 8123 (HTTP), 9000 (TCP) | Analytical database for analytics |
| OpenTelemetry Collector | 4317 (gRPC), 4318 (HTTP) | Observability data collection |
| Service | Command | Description |
|---|---|---|
| Core CLI | cargo run -p core-cli -- [command] |
Command-line interface for managing the application |
| Database Migrations | ./scripts/migrate.sh |
Apply database schema changes |
| Code Generation | ./scripts/generate-code.sh |
Generate code from specifications |
| Development Environment | ./scripts/dev-up.sh |
Start all development services |
| Environment Shutdown | ./scripts/dev-down.sh |
Stop all development services |
First, start all the required database services and observability tools:
./scripts/dev-up.sh
This script will:
To start the main web server:
cd apps/core-web
cargo run
The server will start on port 8080 by default. You can access the API at http://localhost:8080.
To start the background jobs worker:
cd apps/jobs-worker
cargo run
To start the WebSocket gateway:
cd apps/ws-gateway
cargo run
The CLI tool provides various commands for managing the application:
# Navigate to the CLI crate
cd crates/core-cli
# Run CLI commands
cargo run -- --help # Show help
cargo run -- start # Start the server
cargo run -- stop # Stop the server
cargo run -- status # Check server status
cargo run -- health # Run health checks
cargo run -- logs # View logs
cargo run -- config show # Show configuration
cargo run -- db migrate # Run database migrations
GET /healthz - Basic health checkGET /readyz - Readiness probeGET /health - Advanced health check with component statusGET /metrics - Prometheus metrics (available on port 8081)GET /api/v1/users - List all usersPOST /api/v1/users - Create a new userGET /api/v1/users/{id} - Get a specific userPUT /api/v1/users/{id} - Update a specific userDELETE /api/v1/users/{id} - Delete a specific userPOST /api/v1/auth/login - User login endpointPOST /sdk/generate - Generate SDKs for various platformsPOST /docs/generate - Generate API documentationThe project supports several feature flags that can be enabled during compilation:
http3 - Enable HTTP/3 supportpprof - Enable CPU profilingmysql - Enable MySQL supportredis - Enable Redis supportmongo - Enable MongoDB supportclickhouse - Enable ClickHouse supportopenapi - Enable OpenAPI supportgraphql - Enable GraphQL supportgrpc - Enable gRPC supportotel - Enable OpenTelemetry supportTo run with specific features:
cd apps/core-web
cargo run --features "http3,pprof"
The application can be configured using TOML files located in the configs/ directory:
development.toml - Development environment configurationstaging.toml - Staging environment configurationproduction.toml - Production environment configurationEnvironment variables can also be used to override configuration values:
DATABASE_URL - Database connection stringJWT_SECRET - Secret key for JWT token generationSERVER_PORT - Port for the main web serverTo run the test suite:
# Run all tests
cargo test
# Run tests for a specific crate
cd crates/core-analytics
cargo test
To build optimized binaries for production:
# Build all workspace members
cargo build --release
# Build specific binary
cd apps/core-web
cargo build --release
The compiled binaries will be located in the target/release/ directory.
Port conflicts: If you see port conflicts, make sure no other services are running on the required ports or modify the configuration files to use different ports.
Docker issues: Ensure Docker is running and you have sufficient permissions to run Docker commands.
Database connection errors: Verify that the database services are running and the connection strings in the configuration files are correct.
Application logs are output to the console by default. For more detailed logging, you can configure the logging level using environment variables:
RUST_LOG=debug cargo run
We welcome contributions! Please see our Contributing Guide for details on how to get started.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Please note that our main branch is protected with required status checks and code reviews. All pull requests must pass our CI pipeline and receive approval before merging.
This repository implements several security measures:
For detailed information about our security practices, see SECURITY.md.