docs.rs failed to build fortress-api-server-1.0.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Fortress Server
🛡️ Fortress Server - High-performance secure database server with enterprise-grade encryption, clustering, and REST/GraphQL APIs.
Features
- Automatic Encryption/Decryption: All data is automatically encrypted before storage and decrypted after retrieval
- RESTful API: Standard HTTP methods with JSON payloads
- JWT Authentication: Token-based authentication with role-based authorization
- Multi-tenant Support: Isolated data per tenant/organization
- Field-level Encryption: Encrypt specific fields with different algorithms
- Audit Logging: Comprehensive security event logging
- Health Monitoring: Built-in health checks and metrics
- Rate Limiting: Configurable rate limiting and DDoS protection
- CORS Support: Cross-origin resource sharing configuration
- Prometheus Metrics: Export metrics for monitoring
Quick Start
Installation
Add the following to your Cargo.toml:
[]
= "0.1.0"
= { = "1.35", = ["full"] }
= "0.3"
Basic Server
use *;
use ;
async
Run the Example
API Endpoints
Authentication
Login
POST /auth/login
Content-Type: application/json
{
"username": "admin",
"password": "admin123",
"tenant_id": "optional-tenant-id"
}
Refresh Token
POST /auth/refresh
Content-Type: application/json
{
"refresh_token": "your-refresh-token"
}
Data Management
Store Data
POST /data
Authorization: Bearer your-jwt-token
Content-Type: application/json
{
"data": {
"message": "Hello, Fortress!",
"user_id": 123,
"sensitive_info": "secret data"
},
"metadata": {
"category": "user-data",
"priority": "high"
},
"algorithm": "aegis256",
"field_encryption": {
"fields": {
"sensitive_info": {
"algorithm": "aes256gcm",
"sensitivity": "high"
}
}
}
}
Retrieve Data
GET /data/{data_id}
Authorization: Bearer your-jwt-token
List Data
GET /data?page=1&page_size=50&sort=created_at&order=desc
Authorization: Bearer your-jwt-token
Delete Data
DELETE /data/{data_id}
Authorization: Bearer your-jwt-token
Content-Type: application/json
{
"soft_delete": false
}
Key Management
Generate Key
POST /keys
Authorization: Bearer your-jwt-token
Content-Type: application/json
{
"algorithm": "aegis256",
"key_size": 256,
"metadata": {
"purpose": "data-encryption",
"owner": "security-team"
}
}
Monitoring
Health Check
GET /health
Metrics (JSON)
GET /metrics
Prometheus Metrics
GET /metrics/prometheus
Configuration
Server Configuration
use *;
let config = ServerConfig ;
Environment Variables
You can configure the server using environment variables:
Security Features
Authentication & Authorization
- JWT Tokens: Secure token-based authentication
- Role-based Access Control: Fine-grained permissions
- Multi-tenant Isolation: Data separation per organization
- Token Refresh: Automatic token renewal
Encryption
- Automatic Encryption: Data is encrypted before storage
- Multiple Algorithms: Support for AEGIS-256, ChaCha20-Poly1305, AES-256-GCM
- Field-level Encryption: Encrypt specific fields with different algorithms
- Key Management: Automatic key generation and rotation
Rate Limiting
let rate_limit = RateLimitConfig ;
Monitoring & Observability
Health Checks
The server provides comprehensive health checks for all components:
Metrics
Comprehensive metrics are available in both JSON and Prometheus formats:
- HTTP request counts and response times
- Authentication attempts and failures
- Data storage and retrieval metrics
- Encryption/decryption operations
- Rate limit violations
- Error counts by type
Development
Running Tests
Building
Running with Features
# Enable all features
# Enable specific features
Architecture
The Fortress server is built with a modular architecture:
- Handlers: HTTP request handlers for API endpoints
- Middleware: Authentication, logging, rate limiting, CORS
- Authentication: JWT-based auth with role-based authorization
- Health Checks: Component health monitoring
- Metrics: Comprehensive metrics collection and export
- Configuration: Flexible configuration management
Production Deployment
Docker
FROM rust:1.70 as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/fortress-server /usr/local/bin/
EXPOSE 8080
CMD ["fortress-server"]
Environment Configuration
For production, ensure you:
- Set a strong JWT secret
- Enable HTTPS/TLS
- Configure proper rate limiting
- Set up monitoring and alerting
- Enable audit logging
- Use a proper database backend
License
This project is licensed under the Fortress Sustainable Use License 1.0 - see the LICENSE file for details.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.