@@ -7,6 +7,11 @@ A modular and extensible backend API for the DeployStack CI/CD platform, built w
77- ** High-performance** : Built on Fastify for optimal speed and efficiency
88- ** Type-safe** : Written in TypeScript for better development experience
99- ** Modular** : Well-organized code structure for maintainability
10+ - ** Email System** : Integrated email service with Pug templates and SMTP support
11+ - ** Global Settings** : Centralized configuration management with encryption
12+ - ** Database Integration** : SQLite/PostgreSQL support with Drizzle ORM
13+ - ** Plugin System** : Extensible architecture for custom functionality
14+ - ** Authentication** : Lucia-based authentication with role management
1015- ** Logging** : Comprehensive request logging with request IDs and timing
1116- ** Developer-friendly** : Pretty logging in development, production-ready in production
1217
@@ -59,22 +64,68 @@ npm run lint
5964``` bash
6065services/backend/
6166├── src/
62- │ ├── config/ # Configuration files
63- │ │ └── logger.ts # Logger configuration
64- │ ├── hooks/ # Fastify hooks
65- │ │ └── request-logger.ts # Request logging hooks
66- │ ├── plugins/ # Fastify plugins
67- │ │ └── index.ts # Plugin registration
68- │ ├── routes/ # API routes
69- │ │ └── index.ts # Route definitions
67+ │ ├── api/ # API route handlers
68+ │ ├── db/ # Database configuration and schema
69+ │ │ ├── config.ts # Database connection setup
70+ │ │ ├── index.ts # Database exports
71+ │ │ ├── migrations.ts # Migration management
72+ │ │ └── schema.ts # Database schema definitions
73+ │ ├── email/ # Email system (NEW)
74+ │ │ ├── templates/ # Pug email templates
75+ │ │ │ ├── layouts/ # Base layout components
76+ │ │ │ │ ├── base.pug # Main email layout
77+ │ │ │ │ ├── header.pug # Email header
78+ │ │ │ │ └── footer.pug # Email footer
79+ │ │ │ ├── welcome.pug # Welcome email template
80+ │ │ │ ├── password-reset.pug # Password reset template
81+ │ │ │ └── notification.pug # General notification template
82+ │ │ ├── emailService.ts # Main email service
83+ │ │ ├── templateRenderer.ts # Pug template renderer
84+ │ │ ├── types.ts # Email type definitions
85+ │ │ ├── example.ts # Usage examples
86+ │ │ └── index.ts # Email module exports
87+ │ ├── fastify/ # Fastify configuration
88+ │ │ ├── config/ # Fastify setup
89+ │ │ ├── hooks/ # Request/response hooks
90+ │ │ └── plugins/ # Fastify plugins
91+ │ ├── global-settings/ # Global configuration system
92+ │ │ ├── github-oauth.ts # GitHub OAuth settings
93+ │ │ ├── smtp.ts # SMTP email settings
94+ │ │ ├── types.ts # Global settings types
95+ │ │ └── index.ts # Settings initialization
96+ │ ├── hooks/ # Authentication hooks
97+ │ ├── lib/ # External library integrations
98+ │ │ └── lucia.ts # Lucia authentication setup
99+ │ ├── middleware/ # Request middleware
100+ │ ├── plugin-system/ # Plugin architecture
101+ │ ├── plugins/ # Available plugins
102+ │ ├── routes/ # API route definitions
103+ │ │ ├── auth/ # Authentication routes
104+ │ │ ├── db/ # Database management routes
105+ │ │ ├── globalSettings/ # Settings management routes
106+ │ │ ├── roles/ # Role management routes
107+ │ │ └── users/ # User management routes
108+ │ ├── services/ # Business logic services
109+ │ │ ├── globalSettingsService.ts # Settings service
110+ │ │ ├── roleService.ts # Role management
111+ │ │ ├── teamService.ts # Team management
112+ │ │ └── userService.ts # User management
70113│ ├── types/ # TypeScript type definitions
71- │ │ └── fastify.ts # Fastify type extensions
72114│ ├── utils/ # Utility functions
73- │ │ └── banner.ts # Startup banner
115+ │ │ ├── banner.ts # Startup banner
116+ │ │ └── encryption.ts # Encryption utilities
74117│ ├── server.ts # Server configuration
75118│ └── index.ts # Application entry point
119+ ├── drizzle/ # Database migrations
120+ ├── persistent_data/ # Persistent application data
121+ ├── tests/ # Test files
76122├── .env # Environment variables (not in version control)
77- ├── .eslintrc # ESLint configuration
123+ ├── DB.md # Database documentation
124+ ├── GLOBAL_SETTINGS.md # Global settings documentation
125+ ├── Mail.md # Email system documentation (NEW)
126+ ├── PLUGINS.md # Plugin system documentation
127+ ├── ROLES.md # Role management documentation
128+ ├── SECURITY.md # Security documentation
78129├── package.json # Package dependencies and scripts
79130└── tsconfig.json # TypeScript configuration
80131```
@@ -95,6 +146,43 @@ The `services/backend/persistent_data/` directory is designated for storing all
95146
96147This ensures that persistent data is managed in a predictable way and is not scattered across the project.
97148
149+ ## 📧 Email System
150+
151+ DeployStack includes a comprehensive email system with Pug templates and SMTP integration:
152+
153+ ### Quick Start
154+
155+ ``` typescript
156+ import { EmailService } from ' ./src/email' ;
157+
158+ // Send a welcome email
159+ await EmailService .sendWelcomeEmail ({
160+ 161+ userName: ' John Doe' ,
162+ 163+ loginUrl: ' https://app.deploystack.com/login'
164+ });
165+
166+ // Send a notification
167+ await EmailService .sendNotificationEmail ({
168+ 169+ title: ' Deployment Complete' ,
170+ message: ' Your app has been deployed successfully.'
171+ });
172+ ```
173+
174+ ### Configuration
175+
176+ 1 . Configure SMTP settings in the global settings interface
177+ 2 . Required settings: ` smtp.host ` , ` smtp.port ` , ` smtp.username ` , ` smtp.password `
178+ 3 . Optional settings: ` smtp.secure ` , ` smtp.from_name ` , ` smtp.from_email `
179+
180+ ### Documentation
181+
182+ - ** [ Mail.md] ( ./Mail.md ) ** : Complete email system documentation
183+ - ** Templates** : Located in ` src/email/templates/ `
184+ - ** Examples** : See ` src/email/example.ts ` for usage examples
185+
98186## 🌍 Environment Variables
99187
100188Create a ` .env ` file in the ` services/backend ` directory with the following variables:
@@ -103,7 +191,7 @@ Create a `.env` file in the `services/backend` directory with the following vari
103191NODE_ENV=development
104192PORT=3000
105193LOG_LEVEL=debug
106- FOO=bar # Example environment variable used in the demo route
194+ DEPLOYSTACK_ENCRYPTION_SECRET=your-32-character-secret-key-here # Required for global settings encryption
107195```
108196
109197## 🤝 Contributing
0 commit comments