Complete Offline Functionality
CodeInk is designed as a fully offline-capable application. After the initial page load, you can disconnect from the internet and continue editing with zero degradation in functionality.CodeInk works 100% offline once loaded. Your internet connection is only needed to initially download the application code.
How Offline Mode Works
Initial Load Requirements
On your first visit to CodeInk:- Application Code: HTML, CSS, and JavaScript are downloaded from the CDN
- Editor Assets: CodeMirror editor components
- Rendering Libraries: Marked, Mermaid, KaTeX, and Shiki are loaded
- Fonts and Icons: UI assets are cached by the browser
The initial download is approximately 2-3 MB. After this, everything runs locally.
After Initial Load
Once the application is loaded:- All features work offline: Editing, preview, syntax highlighting, math rendering, diagrams
- No network requests: The application never attempts to contact servers
- Local storage only: All data operations use IndexedDB
- No cloud sync: Documents remain on your device
Offline Features
Every CodeInk feature works offline:Document Management
- Create new documents
- Edit existing documents
- Delete documents
- Auto-save changes to IndexedDB
- View document list sorted by last edit
Editor Capabilities
- Real-time markdown editing
- Syntax highlighting for 16+ languages
- Markdown linting with remark-lint
- Auto-fix for common markdown issues
- Multiple view modes (editor, split, preview)
- Resizable split panes
Rendering Features
- Live markdown preview
- Mermaid diagram rendering (flowcharts, sequence diagrams, ER diagrams, Gantt charts, etc.)
- KaTeX math rendering (inline and display mode)
- Code syntax highlighting via Shiki
- GitHub-style alerts (NOTE, TIP, IMPORTANT, WARNING, CAUTION)
- Tables and footnotes
- GitHub Flavored Markdown (GFM) support
All rendering happens in your browser. No external APIs or services are required.
Export Functionality
- Export documents as markdown files
- Download to your local filesystem
- No cloud storage or upload required
Architecture for Offline Operation
CodeInk’s architecture is specifically designed for offline use:No Server Dependencies
- No
fetch()calls to external APIs - No authentication tokens or API keys
- No network error handling (because there are no network requests)
Client-Side Processing
All document processing happens in your browser:- Markdown Parsing:
markedlibrary runs client-side - Diagram Rendering:
mermaidgenerates SVGs locally - Math Rendering:
katexprocesses LaTeX locally - Syntax Highlighting:
shikihighlights code blocks locally - Linting:
remark-lintanalyzes markdown locally
Browser Caching
Modern browsers cache CodeInk’s assets:- Static Assets: HTML, CSS, JavaScript files
- Libraries: CodeMirror, Marked, Mermaid, KaTeX, Shiki
- Fonts: UI typography assets
Testing Offline Mode
To verify CodeInk works offline:Method 1: Browser DevTools
- Open CodeInk in your browser
- Open Developer Tools (F12)
- Go to Network tab
- Enable “Offline” mode
- Continue using CodeInk normally
Method 2: Airplane Mode
- Load CodeInk while online
- Enable airplane mode or disconnect WiFi
- Refresh the page (if cached) or continue with loaded page
- All features should work normally
Method 3: Network Inspection
- Open CodeInk with Network tab open
- Create and edit documents
- Observe that no network requests are made after initial load
After the initial page load, you should see zero network activity during normal document editing operations.
Comparison: Online vs Offline
| Feature | Online | Offline | Notes |
|---|---|---|---|
| Create Documents | ✅ | ✅ | Identical |
| Edit Documents | ✅ | ✅ | Identical |
| Delete Documents | ✅ | ✅ | Identical |
| Markdown Preview | ✅ | ✅ | Identical |
| Mermaid Diagrams | ✅ | ✅ | Identical |
| Math Rendering | ✅ | ✅ | Identical |
| Syntax Highlighting | ✅ | ✅ | Identical |
| Markdown Linting | ✅ | ✅ | Identical |
| Export Documents | ✅ | ✅ | Identical |
| Load Application | ✅ | ⚠️ | Requires browser cache |
The only difference between online and offline operation is the ability to initially load the application. All features are 100% identical.
Browser Storage Persistence
When using CodeInk offline, your data persists in IndexedDB:Data Retention
- Documents remain stored between sessions
- Closing the browser does not delete data
- System restarts do not affect stored documents
- Works across multiple browser tabs
Storage Isolation
Each browser profile maintains separate storage:- Work profile documents are separate from personal profile
- Different browsers have independent storage
- Incognito/private mode uses temporary storage
Deployment Architecture
CodeInk is deployed as a static site:- Hosting: Cloudflare Pages (based on
@astrojs/cloudflaredependency) - Framework: Astro (static site generator)
- Build Output: Pre-rendered HTML and bundled JavaScript
- No Server: No backend, database, or API endpoints
- Fast Initial Load: Static assets served from CDN edge locations
- No Runtime Dependencies: No server to go down or become unavailable
- Offline Capability: Once cached, works without internet
- Complete Privacy: No server-side processing or logging
Privacy Benefits of Offline Operation
Offline functionality provides inherent privacy advantages:No Data Transmission
- Documents never sent to servers
- No analytics pings or tracking beacons
- No usage metrics collected
- No telemetry or crash reporting
No Network Surveillance
- ISPs cannot see your document content
- Network administrators cannot monitor usage
- No DNS lookups during editing
- No external service dependencies
Complete Isolation
- Works on air-gapped systems (after initial load)
- No cloud service integrations
- No third-party API calls
- No external authentication or authorization
Once loaded, CodeInk operates as if it were a native desktop application, with no communication to external systems.
Use Cases for Offline Operation
Ideal Scenarios
- Travel: Edit documents on flights or in areas with poor connectivity
- Privacy-Sensitive Work: Ensure content never touches the network
- Unreliable Internet: Continue working during connection drops
- Corporate Networks: No external dependencies to whitelist
- Bandwidth Conservation: Zero data usage after initial load
- Air-Gapped Systems: Use on isolated networks (with initial cached load)
Example Workflow
Technical Implementation Details
CodeInk’s offline capability comes from its architecture:No Network Code
Reviewing the database implementation (src/lib/db.ts):
- No
fetch()calls - No WebSocket connections
- No AJAX requests
- No external API integrations
indexedDBAPI (browser built-in)- Promise-based async operations
- Local error handling
Client-Side Dependencies
Frompackage.json, all dependencies run client-side:
Build-Time Optimization
Astro pre-renders content at build time:- Static HTML generated during build
- JavaScript bundled and minified
- Assets optimized and compressed
- No server-side rendering required at runtime
Limitations
What Doesn’t Work Offline
What Still Works
- All editing and preview features
- All document management operations
- All rendering capabilities (diagrams, math, code highlighting)
- Export functionality
- Markdown linting and auto-fix
Best Practices for Offline Use
Before Going Offline
- Load CodeInk at least once while online to cache the application
- Create a browser bookmark for easy offline access
- Export critical documents as backup
- Test offline mode before relying on it
During Offline Use
- Use normal browser mode (not incognito) for persistence
- Keep the browser tab open to maintain state
- Export frequently to filesystem as additional backup
- Avoid clearing browser data which would delete cached app and documents
After Returning Online
- Export documents if you need to share or back them up
- Browser will automatically update cache for new versions (optional)
- No synchronization needed - documents remain local
CodeInk has no concept of “sync” because there is no server. Your documents remain on your device whether online or offline.
Comparison with Other Tools
| Feature | CodeInk | Notion | Google Docs | VS Code |
|---|---|---|---|---|
| Works Offline | ✅ | ⚠️ Limited | ❌ No | ✅ Yes |
| No Account Required | ✅ | ❌ | ❌ | ✅ |
| No Installation | ✅ | ❌ | ✅ | ❌ |
| Zero Data Transmission | ✅ | ❌ | ❌ | ✅ |
| Live Markdown Preview | ✅ | ⚠️ Limited | ❌ | ⚠️ Plugin |
| Mermaid Diagrams Offline | ✅ | ❌ | ❌ | ⚠️ Plugin |
Next Steps
Data Storage
Learn how IndexedDB stores your documents locally
Export Documents
Back up your work by exporting to markdown files