Tech Stack
Readme.so is built with modern web technologies:- Next.js 16 - React framework with SSG support
- React 19 - UI library with hooks
- Tailwind CSS 3 - Utility-first CSS framework
- dnd-kit - Modern drag and drop toolkit
- Monaco Editor - VS Code’s editor for markdown editing
- react-markdown - Markdown rendering
- next-i18next - Internationalization
Project Structure
The codebase follows the standard Next.js Pages Router structure:Core Components
SectionsColumn
The sidebar that manages available and selected readme sections. Location:components/SectionsColumn.js:29
Key Features:
- Displays available sections to add
- Shows currently selected sections
- Drag and drop reordering via dnd-kit
- Search/filter functionality
- Section reset and delete operations
selectedSectionSlugs- Array of currently selected section IDssectionSlugs- Array of available section IDstemplates- Section template datadarkMode- Dark mode state
EditPreviewContainer
The main container for the editor and preview columns. Location:components/EditPreviewContainer.js:12
Responsibilities:
- Layout management for editor and preview
- Tab switching between Preview and Raw modes
- Responsive design for mobile/desktop
- Combines markdown from all sections
EditorColumn
Monaco-based markdown editor for editing section content. Location:components/EditorColumn.js
Features:
- Syntax highlighting for markdown
- Real-time editing
- Section-focused editing
- VS Code keybindings
PreviewColumn
Renders the markdown preview using react-markdown. Location:components/PreviewColumn.js
Modes:
- Preview - Rendered HTML view
- Raw - Plain markdown text
CustomSection
Modal dialog for creating custom readme sections. Location:components/CustomSection.js:13
Functionality:
- Input field for section title
- Creates slug from title (e.g., “My Section” → “custom-my-section”)
- Adds new section to templates
- Automatically selects and focuses new section
Custom Hooks
useLocalStorage
Manages localStorage backup of readme templates. Location:hooks/useLocalStorage.js:3
API:
- Debounced save (1 second delay)
- Loads backup on mount
- Stores entire templates array
useDarkMode
Manages dark mode state with localStorage persistence. Location:hooks/useDarkMode.js:5
API:
- Reads initial value from localStorage
- Toggles
darkclass on<html>element - Persists preference to localStorage
- Returns boolean state and setter
useDeviceDetect
Detects mobile vs desktop devices for responsive behavior. Location:hooks/useDeviceDetect.js
API:
Data Flow
Section Templates
Templates are loaded based on locale:State Management Flow
Initial Load
- Page loads with locale-specific templates
useLocalStoragechecks for backup- Backup templates replace defaults if found
- Previous session’s sections restored from localStorage
User Adds Section
- User clicks section in
SectionsColumn - Section slug added to
selectedSectionSlugs - Section removed from available
sectionSlugs focusedSectionSlugupdated to new section- State saved to localStorage
User Edits Section
- User edits markdown in
EditorColumn - Template updated in
templatesarray saveBackup()debounces and saves to localStorage- Preview automatically updates via React state
localStorage Keys
The application uses these localStorage keys:| Key | Purpose | Type |
|---|---|---|
readme-backup | Stores all templates with edits | JSON array |
current-slug-list | Comma-separated selected sections | String |
current-focused-slug | Currently focused section | String |
color-theme | Dark/light mode preference | String |
Internationalization
Multi-language support via next-i18next: Supported Locales:- English (
en_EN) - Portuguese Brazil (
pt_BR) - Turkish (
tr_TR) - Chinese (
cn_CN)
public/locales/{locale}/editor.json
Styling Approach
Tailwind CSS
Utility-first styling with dark mode support:Dark Mode
Tailwind’sdark: variant activated by class on <html>:
Next.js Configuration
Minimal configuration focusing on i18n: Location:next.config.js
- Static Site Generation (SSG) for all pages
getStaticPropsloads locale-specific templates- No server-side runtime needed
Performance Considerations
Optimizations:- Static generation for instant page loads
- Debounced localStorage saves
- Component-level state management
- Lazy loading of Monaco Editor
- PWA support for offline usage
Security Notes
- No authentication required
- No server-side data storage
- No API calls (except for external integrations)
- XSS protection via React’s escaping
Next Steps
Local Setup
Set up your development environment
Contributing
Learn the contribution workflow
Testing
Write tests for components