W3-SHELL (TEMPORARY). swift-server-foundation is dissolved (decomposition W3, 2026-07-14). This package survives as a marked re-export shell ONLY so existing manifests and the app resolve unchanged until the E-program app cutover. Do not add new consumers.
Former concern New home \.date+Date.Generator(C1)swift-clocks-dependencies \.httpClient(C2)deleted — dead code (de-engine R3) \.mainEventLoopGroup(C3)swift-event-loop-group-dependencies console logger handler (C4) swift-logger-handlers Logger.Handler.ConsoleInMemoryStoreTTL cache (C5)swift-time-to-live Store.InMemoryURL.canonical(C6)swift-uri RFC_3986.URI.canonical(host:)Pathconstants (C7)swift-url-routing compat surface EnvVars+\.envVars/\.projectRoot(C8)swift-environment-dependencies throttling × dependencies (C9) swift-throttling-dependencies translating seam swift-translating-dependencies
A foundation library for server-side Swift development that consolidates essential packages for building server applications.
swift-server-foundation provides a unified interface to commonly-used server development packages. Instead of managing multiple dependencies individually, this foundation package re-exports and integrates type safety, authentication, infrastructure, and utility libraries into a single import.
- Type-safe domain models for email addresses, domains, and JWT
- Password validation with customizable security policies
- Cryptographic operations via Apple's Crypto framework
- Rate limiting and request throttling
- HTTP client with async/await support
- Structured logging with Apple's unified logging API
- Environment variable handling with type safety
- URL routing with internationalization support
- Declarative content builders
Add swift-server-foundation to your Package.swift dependencies:
dependencies: [
.package(url: "https://github.com/coenttb/swift-server-foundation.git", from: "0.0.1")
]Import the foundation to access all included packages:
import ServerFoundation
// Logging
let logger = Logger(label: "com.example.app")
// HTTP Client
let client = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
// JWT
let jwt = try JWT(
payload: ["user_id": "12345"],
signedBy: key
)- EmailAddress - Type-safe email address handling
- Domain - Type-safe domain models
- JWT - JSON Web Token implementation
- PasswordValidation - Password validation policies
- Crypto - Cryptographic operations and key management
- Throttling - Rate limiting for API protection
- AsyncHTTPClient - Non-blocking HTTP client
- Logging - Unified logging API
- EnvironmentVariables - Type-safe environment variable handling
- ServerFoundationEnvVars - Environment-specific configuration
- DateParsing - RFC 2822, RFC 5322, and Unix epoch parsing
- FoundationExtensions - Date manipulation and validation
- URLRouting - Type-safe URL routing
- URLRoutingTranslating - Multi-language URL patterns
- Translating - Translation and localization framework
- Builders - Result builders for declarative syntax
- Dependencies - Dependency management
- CasePaths - Key path-like functionality for enums
- IssueReporting - Runtime issue reporting
The ServerFoundationEnvVars module provides type-safe access to environment configuration:
import ServerFoundationEnvVars
// Access with defaults
let port = EnvVars.PORT.value ?? 8080
// Require value (throws if missing)
let apiKey = try EnvVars.API_KEY.require()- swift-environment-variables: A Swift package for type-safe environment variable management.
- swift-jwt: A Swift package for creating, signing, and verifying JSON Web Tokens.
- swift-logger-handlers: Focused logger handlers for Swift Logging.
- swift-password-validation: A Swift package for type-safe password validation.
- swift-throttling: A Swift package for request throttling.
- swift-urlrequest-handler: A Swift package for URLRequest handling with structured error handling.
- coenttb-com-server: Production server for coenttb.com built with Boiler.
- coenttb-newsletter: A Swift package for newsletter subscription and email management.
- coenttb-server: A Swift package for building fast, modern, and safe servers.
- swift-github-live: A Swift package with live implementations for the GitHub API.
- swift-identities-mailgun: A Swift package integrating Mailgun with swift-identities.
- swift-server-foundation-vapor: A Swift package integrating swift-server-foundation with Vapor.
- swift-stripe: The Swift library for the Stripe API.
- swift-stripe-live: A Swift package with live implementations for the Stripe API.
- pointfreeco/swift-dependencies: A dependency management library for controlling dependencies in Swift.
- apple/swift-crypto: Open-source implementation of a substantial portion of the API of Apple CryptoKit.
- apple/swift-log: A Logging API for Swift.
This project is licensed under the Apache 2.0 License. See LICENSE for details.
Contributions are welcome. Please open an issue or submit a pull request on GitHub.