Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(pages): paperless comparison (#49)

Corentin Thomasset324b3f39e960
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 00000000..3c7b8829
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,132 @@
+# CLAUDE.md
+
+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+
+## Project Overview
+
+Papra website is a multilingual static website built with Astro, deployed on Cloudflare. It serves as the marketing site for Papra, a document management and archiving platform.
+
+**Tech Stack:**
+- **Framework:** Astro (static site generation)
+- **Styling:** UnoCSS (atomic CSS with custom theme system, compatible with Tailwind CSS)
+- **Deployment:** Cloudflare (using @astrojs/cloudflare adapter)
+- **Package Manager:** pnpm (version 9.11.0)
+- **Content:** MDX for blog posts and markdown pages
+- **Testing:** Vitest
+
+## Development Commands
+
+```bash
+# Install dependencies
+pnpm install
+
+# Start development server (default port 4321)
+pnpm dev
+
+# Build for production
+pnpm build
+
+# Preview production build
+pnpm preview
+
+# Run linter
+pnpm lint
+
+# Fix linting issues
+pnpm lint:fix
+
+# Type check
+pnpm check
+
+# Run tests
+pnpm test
+
+# Run tests in watch mode
+pnpm test:watch
+```
+
+## Architecture & Key Concepts
+
+### Internationalization (i18n)
+
+The site supports multiple locales (currently `en` and `fr`) with a custom i18n system:
+
+- **Locale Constants:** Defined in `src/i18n/i18n.constants.ts` (`LOCALES`, `DEFAULT_LOCALE`)
+- **Translation Files:** `src/locales/{locale}.ts` - translations are strongly typed
+- **i18n Utilities:** `src/i18n/i18n.ts` provides:
+ - `getLocaleFromUrl(url)` - extracts locale from URL path
+ - `useI18n({ locale })` - returns `{ t, locale }` for translations with @branchlet/core template interpolation
+ - `getPathWithoutLocale(url)` - strips locale prefix from paths
+ - `buildLocalizedPath({ locale, path })` - builds localized URLs
+
+**Routing:**
+- All pages are prefixed with locale: `/{locale}/path`
+- Default locale (`en`) is also prefixed (not at root)
+- Locale-specific pages live in `src/pages/[locale]/`
+- Top-level pages (`src/pages/`) are for non-localized content (RSS, robots.txt, etc.)
+
+### Configuration
+
+**App Config** (`src/app.config.ts`):
+- Site metadata, social links (Discord, sponsor)
+- Launch discount configuration with date-based expiry
+- Get started link to dashboard
+
+**Astro Config** (`astro.config.ts`):
+- Cloudflare adapter for static deployment
+- Custom `createRedirectsFile` plugin generates `_redirects` file for Cloudflare
+- UnoCSS, sitemap, MDX, and expressive-code integrations
+- i18n routing configuration
+
+### Styling System
+
+**UnoCSS Configuration** (`uno.config.ts`):
+- Custom theme using CSS variables (`hsl(var(--primary))` pattern)
+- Theme switching via `[data-kb-theme="dark"]` and `[data-kb-theme="light"]` attributes
+- Custom animations (accordion, collapsible, caret-blink, slideRight, slideDown)
+- Typography preset, icon preset, web fonts (Inter via Bunny provider)
+- Safelist for dynamic grid columns and specific icons
+
+**Global Styles:** `src/styles/` directory
+
+### Content Collections
+
+**Blog Collection** (`src/content/config.ts`):
+- Schema: `title`, `description`, `publishedAt`, optional `homepageCallout`, `lang`, `ogImage`, `coverImage`
+- Posts live in `src/content/blog/`
+- Currently only supports `lang: 'en'`
+
+### Custom Plugins
+
+**Redirects Plugin** (`src/plugins/redirects.ts`):
+- Generates Cloudflare `_redirects` file at build time
+- Used for short URLs like `/discord`, `/support`
+- Accepts `redirects` object in astro.config.ts
+
+### Utility Functions
+
+**URL Utilities** (`src/utils/urls.ts`):
+- Helper functions for URL manipulation
+- Tested in `urls.test.ts`
+
+**Class Name Utilities** (`src/utils/cn.ts`):
+- `cn()` function using `clsx` and `tailwind-merge` for conditional class names
+
+## Linting & Code Style
+
+**ESLint Config** (`eslint.config.js`):
+- Uses `@antfu/eslint-config` with Astro support
+- Semicolons required
+- Enforces curly braces for all control statements (`curly: 'all'`)
+- Uses `test` (not `it`) for Vitest tests
+- Type definitions prefer `type` over `interface`
+- 1TBS brace style, no single-line blocks
+- Ignores inline scripts in `PosthogAnalytics.astro` and `ContactForm.astro`
+
+## Important Notes
+
+- **Always use `pnpm`** - package manager is locked to [email protected]
+- **Translation updates:** When adding new UI text, update all locale files in `src/locales/`
+- **Type safety:** Translations are strongly typed via `TranslationsDictionary`
+- **Deployment:** Site is deployed to Cloudflare, builds are static
+- **Redirects:** Use the astro.config.ts redirects object, not manual _redirects file
diff --git a/src/components/ComparisonTable.astro b/src/components/ComparisonTable.astro
new file mode 100644
index 00000000..6895716b
--- /dev/null
+++ b/src/components/ComparisonTable.astro
@@ -0,0 +1,49 @@
+---
+import { cn } from '../utils/cn';
+
+type ComparisonRow = {
+ feature: string;
+ description?: string;
+ paperless: string;
+ papra: string;
+};
+
+type Props = {
+ rows: ComparisonRow[];
+ class?: string;
+};
+
+const { rows, class: className } = Astro.props;
+---
+
+<div class={cn('not-prose my-12 mx--6 sm:mx-0 lg:mx--48 overflow-hidden', className)}>
+ <table class="w-full border-collapse" style="table-layout: fixed;">
+ <thead>
+ <tr class="bg-card">
+ <th class="text-left px-6 py-4 w-30%"></th>
+ <th class="text-left px-6 py-4 text-sm font-bold text-muted-foreground uppercase tracking-wide w-35%">Paperless-NGX</th>
+ <th class="text-left px-6 py-4 text-sm font-bold text-muted-foreground uppercase tracking-wide rounded-tr-xl w-35%">Papra</th>
+ </tr>
+ </thead>
+ <tbody>
+ {rows.map((row, index) => (
+ <tr class="bg-card transition-colors hover:bg-muted/20 border-t">
+ <td class="px-6 py-5">
+ <div class="font-medium text-foreground">{row.feature}</div>
+ {row.description && (<div class="text-sm text-muted-foreground">{row.description}</div>)}
+ </td>
+ <td class={cn(
+ 'px-6 py-5 text-muted-foreground leading-relaxed',
+ index === rows.length - 1 && 'rounded-br-xl',
+ )}
+ >{row.paperless}</td>
+ <td class={cn(
+ 'px-6 py-5 text-muted-foreground leading-relaxed',
+ index === rows.length - 1 && 'rounded-br-xl',
+ )}
+ >{row.papra}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+</div>
diff --git a/src/layouts/MdPage.astro b/src/layouts/MdPage.astro
index bced19e5..d791cb87 100644
--- a/src/layouts/MdPage.astro
+++ b/src/layouts/MdPage.astro
@@ -1,6 +1,8 @@
---
+import Cta from '../components/Cta.astro';
import Footer from '../components/Footer.astro';
import Header from '../components/Header.astro';
+import { cn } from '../utils/cn';
import Layout from './Layout.astro';
---
@@ -10,8 +12,8 @@ import Layout from './Layout.astro';
<div class="w-full bg-[linear-gradient(to_right,#80808010_1px,transparent_1px),linear-gradient(to_bottom,#80808010_1px,transparent_1px)] bg-[size:48px_48px] bg-background border-b pt-32 pb-24">
<div class="max-w-700px mx-auto p-4">
- <h1 class="text-3xl mb-2 font-bold">{Astro.props.frontmatter.title}</h1>
- <p class="text-base mb-2 leading-tight">{Astro.props.frontmatter.description}</p>
+ <h1 class="text-4xl mb-2 font-bold">{Astro.props.frontmatter.title}</h1>
+ <p class="text-base mb-2 text-muted-foreground lh-1.75rem">{Astro.props.frontmatter.description}</p>
{Astro.props.frontmatter.tags && (
<div class="flex flex-wrap mt-2">
@@ -24,9 +26,13 @@ import Layout from './Layout.astro';
</div>
- <div class="prose prose-invert prose-neutral mx-auto text-base bg-card pb-32 pt-8">
+ <div class="px-6">
+ <div class={cn('prose prose-invert prose-neutral mx-auto text-base bg-card', !Astro.props.frontmatter.withCta && 'pb-32')}>
<slot />
</div>
+ </div>
+
+ {Astro.props.frontmatter.withCta && (<Cta />)}
<Footer class="bg-background" />
</div>
diff --git a/src/pages/en/papra-vs-paperless-ngx.mdx b/src/pages/en/papra-vs-paperless-ngx.mdx
new file mode 100644
index 00000000..cda04877
--- /dev/null
+++ b/src/pages/en/papra-vs-paperless-ngx.mdx
@@ -0,0 +1,151 @@
+---
+layout: ../../layouts/MdPage.astro
+title: Papra vs Paperless-NGX Comparison
+description: Feature comparison between Papra and Paperless-NGX document management systems. Compare storage, scalability, collaboration, and deployment options.
+withCta: true
+---
+
+import ComparisonTable from '../../components/ComparisonTable.astro';
+
+## Why Papra Exists
+
+Paperless-NGX is an excellent, mature project with a large community and extensive features. If it works perfectly for your needs, that's great! However, Papra was created to address specific areas where improvements could be made:
+
+- **User Experience**: Papra is built from the ground up to be intuitive and easy to use, with a focus on modern UI/UX principles
+- **Collaboration**: Designed to make sharing documents with family members and teams easier with organizations and flexible permissions
+- **Modern Architecture**: Built with horizontal scalability and cloud-native deployments in mind from day one
+- **Developer Experience**: Provides modern tooling like a JavaScript SDK and comprehensive API documentation
+
+If you're looking for something that prioritizes these aspects, Papra might be worth exploring.
+
+## Feature Comparison
+
+Here's a detailed comparison between Papra and Paperless-NGX across various dimensions:
+
+<ComparisonTable
+ rows={[
+ {
+ feature: 'File Storage',
+ paperless: 'Local filesystem only',
+ papra: 'Local filesystem, any S3-compatible storage, Azure Blob Storage, in-memory'
+ },
+ {
+ feature: 'Container Size',
+ paperless: '2 containers (App: 1.42GB + Redis: 137MB)',
+ papra: '1 container (963MB)'
+ },
+ {
+ feature: 'Scalability',
+ paperless: 'Primarily single-server, tied to local filesystem',
+ papra: 'Horizontally scalable from the start, cloud-native architecture'
+ },
+ {
+ feature: 'Deployment Options',
+ paperless: 'Self-hosted only (unofficial third-party hosting exists)',
+ papra: 'Self-hosted + official managed cloud service'
+ },
+ {
+ feature: 'Document Ingestion Methods',
+ paperless: 'Web UI, watch folder, CLI, API, email inbox lookup',
+ papra: 'Web UI, watch folder, CLI, API, email ingestion (send-to address)'
+ },
+ {
+ feature: 'Mobile Apps',
+ paperless: 'Multiple third-party mobile applications',
+ papra: 'Official mobile app (coming soon)'
+ },
+ {
+ feature: 'Desktop Apps',
+ paperless: 'Some unmaintained third-party desktop app',
+ papra: 'Official desktop app (coming soon)'
+ },
+ {
+ feature: 'Developer Tools',
+ paperless: 'API + Webhooks',
+ papra: 'API + JS/TS SDK + Webhooks'
+ },
+ {
+ feature: 'Multi-User Support',
+ paperless: 'Yes',
+ papra: 'Yes'
+ },
+ {
+ feature: 'Organizations',
+ paperless: 'No',
+ papra: 'Yes, with flexible organization management'
+ },
+ {
+ feature: 'Sharing & Collaboration',
+ paperless: 'Multi-user but limited shared collection support',
+ papra: 'Built-in organization structure makes sharing with family and teams easier'
+ },
+ {
+ feature: 'License',
+ paperless: 'GPL-3.0',
+ papra: 'AGPL-3.0'
+ },
+ {
+ feature: 'Maturity',
+ paperless: 'Very mature, established project',
+ papra: 'Newer, actively developed'
+ },
+ {
+ feature: 'Community',
+ paperless: 'Large, well-established ecosystem',
+ papra: 'Growing community'
+ },
+ {
+ feature: 'Target Audience',
+ paperless: 'Tech-savvy users comfortable with self-hosting',
+ papra: 'Users looking for modern, intuitive experience'
+ },
+ {
+ feature: 'Documentation',
+ paperless: 'Extensive and mature, many community resources and tutorials',
+ papra: 'Growing and improving'
+ }
+ ]}
+/>
+
+## Which Should You Choose?
+
+Both Papra and Paperless-NGX are excellent open-source solutions for document management. Your choice depends on your specific needs:
+
+### Choose Paperless-NGX if:
+- You want a mature, battle-tested solution with years of development
+- You're part of the existing Paperless ecosystem and community
+- You prefer a single-server setup with local filesystem storage
+- You're satisfied with the current feature set and user experience
+- You want access to multiple third-party mobile applications
+
+### Choose Papra if:
+- You prioritize modern, intuitive user experience
+- You need flexible storage options (S3, Azure Blob, etc.)
+- You want built-in organization features for easier family/team sharing
+- You're planning for horizontal scalability from the start
+- You prefer an official managed cloud option instead of self-hosting
+- You want modern developer tooling like a JavaScript SDK
+- You value a more streamlined, lightweight container setup
+
+### Try Both!
+
+Since both projects are open-source and self-hostable, you can try both to see which fits your workflow better. Many users have successfully migrated between different document management solutions.
+
+- **Paperless-NGX**:
+ - Demo: [demo.paperless-ngx.com](https://demo.paperless-ngx.com/)
+ - GitHub: [github.com/paperless-ngx/paperless-ngx](https://github.com/paperless-ngx/paperless-ngx)
+ - Documentation: [docs.paperless-ngx.com](https://docs.paperless-ngx.com/)
+- **Papra**:
+ - Demo: [demo.papra.app](https://demo.papra.app)
+ - GitHub: [github.com/papra-app/papra](https://github.com/papra-app/papra)
+ - Documentation: [docs.papra.app](https://docs.papra.app/)
+
+## Final Thoughts
+
+Both projects share the same goal: helping people manage their documents effectively. Your choice depends on your specific needs, technical comfort level, and preferences.
+
+We encourage you to try both and see what works best for your workflow. The document management space benefits from having multiple quality open-source options, and we're grateful for the foundation the Paperless-NGX team has built.
+
+---
+
+*Have questions about Papra or want to discuss features? Join our [Discord community](https://discord.gg/8UPjzsrBNF) or reach out via our [contact page](/en/contact).*