Skip to content

dcoric/redstone

Repository files navigation

Redstone

An Obsidian-like knowledge management application with markdown support, folder organization, and multi-device sync.

Tech Stack

  • Monorepo: pnpm workspaces + Turborepo
  • Web: Next.js 16 (App Router) with TypeScript
  • Mobile: Expo React Native (in progress)
  • Database: PostgreSQL 15+ with Prisma ORM
  • Authentication: NextAuth.js (web) + JWT (mobile)

Project Structure

redstone/
├── apps/
│   ├── web/              # Next.js web application
│   └── mobile/           # Expo mobile app (in progress)
├── packages/
│   ├── shared/           # Shared TypeScript types and utilities
│   ├── database/         # Prisma schema and client
│   ├── api-client/       # Shared API client
│   └── markdown/         # Markdown utilities
├── docker/               # Docker configuration
│   └── docker-compose.yml
├── PLAN.md              # Detailed development plan
└── API.md               # API documentation

Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 8+
  • Docker & Docker Compose (for PostgreSQL)

Installation

  1. Clone the repository:
git clone <repository-url>
cd redstone
  1. Install dependencies:
pnpm install
  1. Start PostgreSQL database:
cd docker && docker-compose up -d
  1. Set up environment variables:
cp .env.example apps/web/.env.local
# Edit apps/web/.env.local if needed
  1. Run database migrations and seed:
pnpm --filter @redstone/database db:generate
pnpm --filter @redstone/database db:migrate
pnpm --filter @redstone/database db:seed
  1. Start the development server:
pnpm dev:web

The web app will be available at http://localhost:3000

Test Credentials

After running the seed script, you can use:

  • Email: test@redstone.app
  • Password: password123

Development Commands

# Run all apps
pnpm dev

# Run specific apps
pnpm dev:web          # Next.js web app
pnpm dev:mobile       # Expo mobile app (when ready)

# Database commands
pnpm --filter @redstone/database db:generate    # Generate Prisma client
pnpm --filter @redstone/database db:migrate     # Run migrations
pnpm --filter @redstone/database db:seed        # Seed database
pnpm --filter @redstone/database db:studio      # Open Prisma Studio

# Build
pnpm build            # Build all apps

# Test
pnpm test             # Run tests

# Lint
pnpm lint             # Lint all packages

Features

Implemented ✅

  • Authentication

    • User registration and login
    • NextAuth.js for web (cookie-based)
    • JWT tokens for mobile API access
  • File Management

    • Create, read, update, delete files
    • Markdown content support
    • Automatic versioning on content changes
    • Search by title and content
    • Soft deletes for sync
  • Folder Organization

    • Create nested folders
    • Move files between folders
    • Tree structure with file counts
  • Tag System

    • Add/remove tags from files
    • Auto-create tags
    • Tag-based organization
  • Sync API

    • Incremental sync for mobile
    • Change tracking since timestamp

Implemented (Frontend) ✅

  • Authentication UI

    • Login and signup pages
    • Session management with NextAuth
    • Route protection middleware
    • User menu with logout
  • API Client & Hooks

    • Typed API client with authenticated requests
    • SWR hooks for data fetching (useFiles, useFolders, useAuth)
    • Automatic cookie handling for NextAuth sessions
  • UI Components

    • File browser interface with real-time data
    • Markdown editor with live preview (CodeMirror 6)
    • Folder navigation sidebar with tree structure
    • File creation, editing, and deletion
    • Folder-based file filtering
    • Search interface (UI ready)

Implemented (Data Integration) ✅

  • File Operations

    • Create new files with "New File" button
    • Load and edit files in markdown editor
    • Save file changes with auto-detection of unsaved changes
    • Delete files with confirmation dialog
    • Navigate to files by clicking file cards
    • Real-time file list updates
  • Folder Integration

    • Load folder tree from API
    • Filter files by selected folder
    • Display file counts per folder
    • "All Files" view for root level

Planned 🚧

  • Web Frontend (Remaining Features)

    • Implement search functionality
    • Add tag management UI
    • Folder creation/deletion UI
  • Mobile App (Phase 5)

    • Expo React Native app
    • Offline support
    • Mobile-optimized editor
  • Advanced Features (Phase 6)

    • Real-time sync (WebSockets/SSE)
    • Internal linking between files
    • File attachments
    • Export to PDF/HTML
    • Graph view of connections

API Documentation

See API.md for complete API documentation.

Quick example:

# Login
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"test@redstone.app","password":"password123"}'

# Get files (use token from login response)
curl -X GET http://localhost:3000/api/files \
  -H "Authorization: Bearer <your-token>"

Database Schema

Key models:

  • User: User accounts
  • File: Markdown files with content
  • Folder: Nested folder structure
  • FileVersion: Version history for files
  • Tag: User-created tags
  • FileTag: Many-to-many relationship between files and tags

See packages/database/prisma/schema.prisma for the complete schema.

Project Status

Phase 1 Complete: Monorepo setup ✅ Phase 2 Complete: Core backend API ✅ Phase 3 Complete: Web frontend UI components ✅ Phase 4 Complete: Web frontend API integration

  • ✅ Authentication & infrastructure (production-ready)
    • Full type safety (zero any types)
    • SWR hooks and configuration
    • NextAuth v5 compatible middleware
    • Error boundaries
    • Build passing with zero errors
  • ✅ Data integration (wire UI to API endpoints)
    • File CRUD operations fully functional
    • Folder navigation connected to API
    • Real-time data fetching and updates
    • Loading and error states ⏳ Phase 5 Planned: Mobile app ⏳ Phase 6 Planned: Advanced features (search, tags UI, folder management)

See PLAN.md for detailed implementation plan and IMPROVEMENTS.md for recent code quality improvements.

License

MIT

About

Redstone is a knowledge management application similar to Obsidian, featuring markdown file storage, editing, and synchronization across web and mobile platforms.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages