Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blind Insight - Platform Engineer Coding Challenge

This project is a secure document storage and retrieval API built with Express.js and TypeScript, simulating a simplified encrypted storage system with authentication, audit logging, and encrypted data at rest.


🛠️ Tech Stack

  • Backend: Node.js, Express.js, TypeScript
  • Auth: JWT (JSON Web Tokens)
  • Database: MongoDB (supports both local and Atlas)
  • Encryption: AES-256-CBC with Node.js crypto
  • Testing: Jest, Supertest
  • Docs: Optional Swagger support
  • Deployment: Docker-ready (optional)

🚀 Features

  • 🔐 JWT Authentication
  • 📄 Encrypted Document Storage
  • 📥 Document Retrieval with Decryption
  • 📝 Metadata Filtering
  • 🛡️ Role-Based Access to Audit Logs
  • 📊 Audit Logging for all API activity
  • Unit tests for core functionality

📦 Installation

npm install

🔐 Environment Variables

Create a .env file in the root directory:

PORT=3000
MONGODB_URI=mongodb://localhost:27017/secure_document_storage
JWT_SECRET=secret-key
SECRET_KEY=secret-key

To use MongoDB Atlas, replace MONGO_URI with your Atlas URI.


🧪 Run the App

npm run dev

🧪 Run Tests

npm test

🧪 API Endpoints

🔐 Auth

POST /api/auth/login

Request:

{
  "username": "user1",
  "password": "password123"
}

Response:

{
  "token": "JWT_TOKEN"
}

📄 Documents

  • POST /api/documents – Store a document (with JWT)
  • GET /api/documents – List documents of user
  • GET /api/documents/:id – Retrieve a single document

📊 Logs

GET /api/logs

Requires admin role.


🧱 Design Choices

  • Encryption: Used crypto module (AES-256-CBC)
  • Auth: JWT-based for stateless validation
  • Audit Logging: Captures every access, success/failure, and user info
  • Database: Swappable between local MongoDB and MongoDB Atlas

🐳 Docker Support (Optional)

docker build -t code-challenge .
docker run -p 3000:3000 code-challenge

📁 Project Structure

src/
├── __tests__/
├── config/
├── controllers/
├── lib/
├── middlewares/
├── models/
├── routes/
├── services/
├── swagger/
├── app.ts
├── server.ts
└── swagger.ts

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages