A reusable security-first template for building enterprise-grade applications with comprehensive IT security built-in.
Extract from: AiNBot/feature/the-hardener
Every builder, defender, and contributor who uses The Fortress swears allegiance to our core principles.
Read the full formal oath: OATH.md
"In the digital realm where code is law and security is life, I swear to defend this fortress against all threats. I commit to grow the code with purpose, not haste. I pledge to lead with vision, not ego. I honor the crewβfrom Captain to Commanderβand serve the users whose trust we have been given. So help me, the CHEST."
A complete IT security hardening framework covering:
- π Network Security β Firewall rules, TLS 1.3+, offline mode
- π Data Encryption β AES-256-GCM at rest, transit, memory
- π€ Authentication β MFA, WebAuthn, RBAC/ABAC, session management
- π Audit & Compliance β Immutable logs, forensics, GDPR ready
- π¨ Threat Detection β Anomaly detection, intrusion prevention
- π¦ Supply Chain β Dependency validation, SBOM, SRI integrity
- π Incident Response β Multi-channel alerts, auto-containment, recovery
git clone https://github.com/JakeDot/The-Fortress-Template.git my-secure-project
cd my-secure-project
npm installexport FORTRESS_PROFILE=production # or: development, staging, military-gradenpm run fortress:initThis sets up:
- Encryption vaults
- Audit logging
- Rate limiting
- Threat detection
- Compliance tracking
Add your business logic. The Fortress handles security.
npm run build
npm startThe-Fortress-Template/
βββ src/
β βββ security/ # Core security modules (30+)
β βββ network/ # Firewall, TLS, offline mode
β βββ crypto/ # Encryption, memory guards
β βββ auth/ # MFA, RBAC, sessions
β βββ audit/ # Logging, compliance
β βββ threat/ # Detection, intrusion prevention
β βββ supply/ # Dependency validation, SBOM
β βββ incident/ # Alerting, containment, recovery
β βββ config/ # Policies, profiles
β βββ types/ # TypeScript definitions
βββ tests/
β βββ security/ # 150+ security tests
βββ docs/
β βββ FORTRESS-GUIDE.md # Getting started
β βββ THREAT-MODEL.md # Attack surfaces
β βββ HARDENING-PROFILES.md # Profile options
β βββ INCIDENT-RESPONSE.md # Playbooks
β βββ COMPLIANCE-MATRIX.md # Standards coverage
βββ .github/
β βββ workflows/ # Security CI/CD
β βββ security-scan.yml
β βββ dependency-audit.yml
β βββ hardening-verify.yml
βββ package.json
βββ tsconfig.json
βββ jest.config.js
Choose the right profile for your environment:
FORTRESS_PROFILE=development- Local-only TLS
- Verbose logging (debug)
- Minimal rate limiting
- Quick iteration
FORTRESS_PROFILE=staging- Full TLS
- Standard logging
- Standard rate limiting
- Production-like
FORTRESS_PROFILE=production- Hardened TLS (1.3 only)
- Encrypted logs
- Aggressive rate limiting
- Full audit trail
- Threat detection ON
FORTRESS_PROFILE=military-grade- All production hardening +
- Hardware security token support
- Offline/air-gap capable
- Zero-trust architecture
- Continuous threat scanning
import { FirewallManager } from './security/network/FirewallManager';
import { TLSManager } from './security/network/TLSManager';
import { OfflineMode } from './security/network/OfflineMode';
const firewall = new FirewallManager();
const tls = new TLSManager();
const offline = new OfflineMode();import { EncryptionVault } from './security/crypto/EncryptionVault';
import { MemoryGuard } from './security/crypto/MemoryGuard';
const vault = new EncryptionVault();
const encrypted = await vault.encrypt(sensitiveData);import { AdvancedAuthManager } from './security/auth/AdvancedAuthManager';
import { RBACEngine } from './security/auth/RBACEngine';
const auth = new AdvancedAuthManager();
await auth.enableMFA(userId);import { AnomalyDetector } from './security/threat/AnomalyDetector';
import { IntrusionDetection } from './security/threat/IntrusionDetection';
const anomaly = new AnomalyDetector();
const intrusion = new IntrusionDetection();import { ImmutableAuditLog } from './security/audit/ImmutableAuditLog';
import { ComplianceEngine } from './security/audit/ComplianceEngine';
const auditLog = new ImmutableAuditLog();
const compliance = new ComplianceEngine();Run security tests:
# All security tests
npm test -- tests/security
# Specific module
npm test -- tests/security/crypto
# With coverage
npm test -- --coverage tests/security
# Penetration testing
npm run test:penetrate
# Cryptographic validation
npm run test:crypto
# Memory safety
npm run test:memory-safetyThe Fortress supports:
- β GDPR β Right to be forgotten, data retention
- β HIPAA β PHI encryption, audit trails
- β SOC 2 β Access controls, incident response
- β ISO 27001 β Information security management
- β PCI-DSS β Payment data protection (if needed)
- β OWASP β Top 10 mitigations built-in
- β CWE Top 25 β All addressed
Generate compliance report:
npm run compliance:reportWhen a threat is detected:
- Alert β Multi-channel (email, Slack, webhook)
- Contain β Rate limit escalation, circuit breaker
- Investigate β Forensics collection, timeline reconstruction
- Recover β Backup restoration, health verification
See docs/INCIDENT-RESPONSE.md for playbooks.
Automated security scanning:
# Daily threat scan
npm run threat:scan
# Weekly penetration test
npm run test:penetrate
# Monthly security audit
npm run audit:full
# Continuous dependency checking
npm run deps:audit- FORTRESS-GUIDE.md β Getting started
- THREAT-MODEL.md β Attack surface analysis
- HARDENING-PROFILES.md β Profile details
- INCIDENT-RESPONSE.md β Response procedures
- COMPLIANCE-MATRIX.md β Standards coverage
| Feature | Development | Staging | Production | Military-Grade |
|---|---|---|---|---|
| TLS | 1.2+ | 1.2+ | 1.3 only | 1.3 + HST |
| Encryption | Optional | Required | Required | Hardware token |
| Rate Limiting | Loose | Standard | Aggressive | Adaptive |
| Logging | Verbose | Standard | Encrypted | Tamper-proof |
| Audit Trail | No | Yes | Yes | Immutable |
| Threat Detection | No | Basic | Full | Real-time |
| Offline Mode | No | No | No | Yes |
| Air-Gap Capable | No | No | No | Yes |
Security improvements always welcome. See CONTRIBUTING.md.
All security PRs must:
- Pass security tests (100% coverage)
- Pass penetration testing
- Include threat model updates
- Document any new attack surface
MIT β Use freely. Security is everyone's responsibility.
The Fortress template is production-ready. Build with confidence. π°βοΈ