Skip to content

Commit b284672

Browse files
committed
docs: update project documentation
- Updated README.md with new architecture - Updated CHANGELOG.md with v1.0.0 changes - Updated SECURITY.md with security policy - Updated CONTRIBUTING.md with contribution guide - Added TROUBLESHOOTING.md for common issues
1 parent 7a474a0 commit b284672

File tree

6 files changed

+1581
-475
lines changed

6 files changed

+1581
-475
lines changed

CHANGELOG.md

Lines changed: 198 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,205 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/).
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
---
79

810
## [Unreleased]
911

10-
## [1.0.0] - YYYY-MM-DD
12+
### Planned
13+
14+
- MySQL adapter support
15+
- Redis caching layer
16+
- Query builder interface
17+
- Soft delete built-in support
18+
- Audit logging
19+
20+
---
21+
22+
## [1.0.0] - 2026-01-31
23+
24+
### 🎉 Initial Release
25+
26+
Complete refactoring following CISCODE AuthKit patterns and best practices.
27+
1128
### Added
12-
- Initial release.
29+
30+
#### Core Features
31+
32+
- **Unified Repository API** - Same interface for MongoDB and PostgreSQL
33+
- `create(data)` - Create new records
34+
- `findById(id)` - Find by primary key
35+
- `findAll(filter)` - Find all matching records
36+
- `findPage(options)` - Paginated queries
37+
- `updateById(id, data)` - Update by primary key
38+
- `deleteById(id)` - Delete by primary key
39+
- `count(filter)` - Count matching records
40+
- `exists(filter)` - Check if records exist
41+
42+
#### NestJS Integration
43+
44+
- **DatabaseKitModule** - NestJS module with DI support
45+
- `forRoot(options)` - Synchronous configuration
46+
- `forRootAsync(options)` - Async configuration with factory
47+
- `forFeature(token, config)` - Multiple database connections
48+
49+
#### Database Adapters
50+
51+
- **MongoAdapter** - MongoDB support via Mongoose
52+
- Connection pooling
53+
- Auto-reconnection
54+
- Lean queries by default
55+
- **PostgresAdapter** - PostgreSQL support via Knex
56+
- Connection pooling
57+
- Advanced filter operators (gt, gte, lt, lte, in, nin, like, etc.)
58+
- Column whitelisting for security
59+
60+
#### Services
61+
62+
- **DatabaseService** - Main facade for database operations
63+
- Unified interface for both databases
64+
- Connection lifecycle management
65+
- Repository factory methods
66+
- **LoggerService** - Structured logging
67+
- NestJS Logger integration
68+
- Context-aware logging
69+
70+
#### Middleware
71+
72+
- **@InjectDatabase()** - Decorator for injecting DatabaseService
73+
- **@InjectDatabaseByToken(token)** - Decorator for named connections
74+
75+
#### Filters
76+
77+
- **DatabaseExceptionFilter** - Global exception handling
78+
- MongoDB error parsing
79+
- PostgreSQL error parsing
80+
- Consistent error response format
81+
82+
#### Utilities
83+
84+
- Pagination helpers (`normalizePaginationOptions`, `calculatePagination`)
85+
- Validation helpers (`isValidMongoId`, `isValidUuid`, `sanitizeFilter`)
86+
87+
#### Configuration
88+
89+
- Environment-driven configuration
90+
- Config validation with fail-fast errors
91+
- Connection string validation
92+
93+
#### Documentation
94+
95+
- Comprehensive README with examples
96+
- SECURITY.md with vulnerability reporting guidelines
97+
- TROUBLESHOOTING.md with common issues
98+
- CONTRIBUTING.md with development guidelines
99+
- copilot-instructions.md for AI-assisted development
100+
101+
### Changed
102+
103+
#### Architecture Improvements
104+
105+
- Restructured to follow AuthKit patterns
106+
- Separated concerns into adapters, services, and contracts
107+
- Moved from `core/` structure to proper layer separation
108+
109+
#### Naming Conventions
110+
111+
- All files now use kebab-case with suffixes
112+
- Consistent class naming (PascalCase)
113+
- Consistent function naming (camelCase)
114+
115+
#### TypeScript Improvements
116+
117+
- Added path aliases for clean imports
118+
- Stricter TypeScript configuration
119+
- Full type coverage with no implicit any
120+
121+
### Fixed
122+
123+
- N/A (initial release)
124+
125+
### Security
126+
127+
- Column whitelisting for PostgreSQL repositories
128+
- Parameterized queries to prevent injection
129+
- Error sanitization in exception filter
130+
- No credentials in error messages
131+
132+
### Breaking Changes
133+
134+
- N/A (initial release)
135+
136+
---
137+
138+
## Pre-1.0 History
139+
140+
### [0.x.x] - Development
141+
142+
- Initial development and prototyping
143+
- Basic MongoDB and PostgreSQL adapters
144+
- Simple NestJS module integration
145+
146+
---
147+
148+
## Migration Guide
149+
150+
### From Pre-1.0 to 1.0.0
151+
152+
If you were using a pre-release version, follow these steps:
153+
154+
1. **Update imports:**
155+
156+
```typescript
157+
// Before
158+
import { Database } from "@ciscode/database-kit/core/database";
159+
160+
// After
161+
import { DatabaseService } from "@ciscode/database-kit";
162+
```
163+
164+
2. **Update module configuration:**
165+
166+
```typescript
167+
// Before
168+
DatabaseModule.forRoot(config);
169+
170+
// After
171+
DatabaseKitModule.forRoot({ config });
172+
```
173+
174+
3. **Update decorator usage:**
175+
176+
```typescript
177+
// Before
178+
@InjectDatabase() private db: Database
179+
180+
// After
181+
@InjectDatabase() private db: DatabaseService
182+
```
183+
184+
4. **Update repository creation:**
185+
```typescript
186+
// Methods remain the same
187+
const repo = db.createMongoRepository<User>({ model: UserModel });
188+
```
189+
190+
---
191+
192+
## Release Schedule
193+
194+
We follow semantic versioning:
195+
196+
- **Patch releases (x.x.X)**: Bug fixes, released as needed
197+
- **Minor releases (x.X.0)**: New features, ~monthly
198+
- **Major releases (X.0.0)**: Breaking changes, ~annually
199+
200+
---
201+
202+
## Links
203+
204+
- [GitHub Releases](https://github.com/CISCODE-MA/DatabaseKit/releases)
205+
- [npm Package](https://www.npmjs.com/package/@ciscode/database-kit)
206+
- [Documentation](https://github.com/CISCODE-MA/DatabaseKit#readme)

CODE_OF_CONDUCT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ It also applies when individuals are representing the project in public spaces.
4545

4646
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers at:
4747

48-
**<YOUR_CONTACT_EMAIL_OR_SECURITY_EMAIL>**
48+
**info@ciscode.com**
4949

5050
All complaints will be reviewed and investigated promptly and fairly.
5151

0 commit comments

Comments
 (0)