Skip to content

StarShiny0325/NDLE-second-brain

Repository files navigation

NDLE - Note-taking, Daily Logging, and Learning Enhancement

A full-stack AI-powered note-taking and daily logging application.

Monorepo Structure

ndle/
├── apps/
│   ├── frontend/          # React + Vite frontend
│   └── backend/           # Hono + Lambda backend
├── packages/
│   └── shared/            # Shared types, validation, utilities
├── infrastructure/        # AWS CDK infrastructure
├── package.json           # Workspace configuration
├── turbo.json             # Turborepo configuration
└── tsconfig.json          # Root TypeScript configuration

Tech Stack

Layer Technology
Frontend React 19, Vite, Tailwind CSS, Redux Toolkit
Backend Hono, AWS Lambda (Node.js 24), DynamoDB
AI Google Gemini 2.5 Pro, Pinecone Vector DB
Auth AWS Cognito
Infrastructure AWS CDK, CloudFront, API Gateway
Monorepo npm workspaces, Turborepo

Prerequisites

  • Node.js 22+
  • npm 10+
  • AWS CLI configured with credentials
  • AWS CDK CLI (npm install -g aws-cdk)

Quick Start

# Install all dependencies (workspaces handle linking)
npm install

# Build shared package first (other packages depend on it)
npm run build:shared

# Development
npm run dev                 # Start all apps in dev mode
npm run dev:frontend        # Start only frontend
npm run dev:backend         # Start only backend

# Build
npm run build               # Build all packages (Turborepo)
npm run build:frontend      # Build only frontend
npm run build:backend       # Build only backend

# Test
npm run test                # Run all tests
npm run test:backend        # Run backend tests only

# Lint
npm run lint                # Lint all packages

Package Scripts

Root Commands (via Turborepo)

Command Description
npm run build Build all packages in dependency order
npm run dev Start all apps in development mode
npm run test Run all tests
npm run lint Lint all packages
npm run clean Remove all build artifacts

Individual Workspace Commands

# Run command in specific workspace
npm run build -w @ndle/shared    # Build shared package
npm run dev -w frontend          # Start frontend dev server
npm run test -w backend          # Run backend tests
npm run deploy -w infrastructure # Deploy CDK stacks

Shared Package

The @ndle/shared package contains:

  • Types: Entity definitions, API contracts, service interfaces
  • Validation: Zod schemas for runtime validation
  • Utils: Shared utilities for parameter extraction, logging, etc.

Importing from Shared

// In frontend or backend
import { Types, Validation } from '@ndle/shared';
import type { Conversation, Message } from '@ndle/shared/types';
import { ConversationSchema } from '@ndle/shared/validation';

Infrastructure

The infrastructure is managed with AWS CDK and split into two stacks:

Foundation Stack (stable, rarely changes)

  • Cognito User Pool & Client
  • DynamoDB Table
  • S3 Bucket
  • CloudFront Distribution

Backend Stack (changes frequently)

  • Lambda Functions (API + Streaming)
  • API Gateway

Deploy Infrastructure

cd infrastructure

# Bootstrap CDK (one-time per account/region)
npx cdk bootstrap

# Set required environment variables
export GOOGLE_GENERATIVE_AI_API_KEY=your-key
export PINECONE_API_KEY=your-key

# Deploy all stacks
npm run deploy -- -c env=dev

# Deploy specific stack
npm run deploy:foundation -- -c env=dev
npm run deploy:backend -- -c env=dev

# Preview changes
npx cdk diff -c env=dev

CI/CD

GitHub Actions workflows are configured for:

  • CI (ci.yml): Runs on PRs - lint, type-check, test, build
  • Deploy (deploy.yml): Runs on push to main - deploys to AWS

Required GitHub Secrets:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • GOOGLE_GENERATIVE_AI_API_KEY
  • PINECONE_API_KEY

Development Workflow

  1. Make changes to any package
  2. Turborepo detects what changed
  3. Only affected packages are rebuilt/tested
  4. Caching speeds up subsequent builds
# Turborepo shows what it's doing
npm run build

# Output:
# @ndle/shared:build: cache hit, replaying logs
# frontend:build: cache miss, executing
# backend:build: cache hit, replaying logs

Environment Variables

Frontend (apps/frontend/.env.local)

VITE_AWS_COGNITO_USER_POOL_ID=
VITE_AWS_COGNITO_USER_POOL_WEB_CLIENT_ID=
VITE_AWS_REGION=us-west-1
VITE_API_BASE_URL=
VITE_STREAMING_API_URL=

Backend (deployed via CDK)

Environment variables are injected by CDK from secrets.

License

Private - All rights reserved

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages