A modern, minimalist text sharing platform built with TypeScript, React, and Cloudflare Workers. Share text snippets instantly with support for both anonymous and authenticated posting.
- Instant Text Sharing - Create and share text snippets with a single click
- Anonymous & Authenticated Posting - Post anonymously or create an account for enhanced features
- Privacy Controls - Choose between public, unlisted, or private visibility for your texts
- Clean & Minimal UI - Beautiful, distraction-free interface built with shadcn/ui
- Responsive Design - Works perfectly on desktop and mobile devices
- Fast & Reliable - Built on Cloudflare Workers for global edge deployment
- Type-Safe APIs - End-to-end type safety with tRPC
- Real-time Updates - Instant UI updates with React Query
- React 19 - Modern React with latest features
- TanStack Router - Type-safe file-based routing
- TanStack Query - Powerful data fetching and caching
- TailwindCSS - Utility-first CSS framework
- shadcn/ui - Beautiful, accessible components
- Vite - Fast build tool and dev server
- Hono - Lightweight, fast web framework for Cloudflare Workers
- tRPC - End-to-end type-safe APIs
- Drizzle ORM - TypeScript-first ORM
- Cloudflare D1 - Serverless SQLite database
- Better Auth - Modern authentication solution
- Cloudflare Workers - Serverless edge runtime
- TurboRepo - Monorepo build system
- TypeScript - Full type safety across the stack
- Node.js 18+
- npm or bun package manager
- Cloudflare account (for deployment)
-
Clone the repository
git clone https://github.com/robertplawski/txtshr.git cd txtshr -
Install dependencies
npm install
-
Set up environment variables
Copy the example files and configure your environment:
# For the web app cp apps/web/.env.example apps/web/.env # For the server cp apps/server/.env.example apps/server/.env
-
Set up the database
npm run db:push
-
Start the development servers
npm run dev
This will start:
- Frontend: http://localhost:3001
- Backend API: http://localhost:3000
- Anonymous Posting: Simply enter a title and content, then click "Create Text"
- Authenticated Posting: Sign up/in to access privacy controls and manage your texts
- Public: Visible to everyone on the homepage
- Unlisted: Only accessible with direct link
- Private: Only you can see it (requires account)
- View all your texts from your profile
- Delete texts you've created
- Share texts via direct links
- Copy text content to clipboard
txtshr/
βββ apps/
β βββ web/ # Frontend React application
β β βββ src/
β β β βββ components/ # Reusable UI components
β β β βββ routes/ # TanStack Router routes
β β β βββ lib/ # Utilities and configurations
β β β βββ utils/ # Helper functions
β β βββ package.json
β βββ server/ # Backend API
β βββ src/
β β βββ db/ # Database schema and migrations
β β βββ lib/ # Server utilities
β β βββ routers/ # tRPC route handlers
β βββ package.json
βββ package.json # Root package.json with scripts
βββ README.md
npm run dev- Start all applications in development modenpm run dev:web- Start only the web applicationnpm run dev:server- Start only the server
npm run build- Build all applications for productionnpm run check-types- Check TypeScript types across all apps
npm run db:push- Push schema changes to databasenpm run db:studio- Open Drizzle Studio database UInpm run db:generate- Generate new migrationsnpm run db:migrate- Run pending migrations
VITE_API_URL=http://localhost:3000
DATABASE_URL=your-database-url
BETTER_AUTH_SECRET=your-auth-secret
BETTER_AUTH_URL=http://localhost:3000
The application uses Cloudflare D1 (SQLite) with Drizzle ORM. For local development:
- Local Development: The database runs automatically with
wrangler dev - Production: Configure your Cloudflare D1 database in wrangler.jsonc
-
Configure wrangler.jsonc in apps/server/
-
Set up Cloudflare D1 database
-
Deploy the server
cd apps/server npm run deploy -
Build and deploy the frontend
npm run build # Deploy the built files to your preferred hosting service
- Development: Uses local SQLite database
- Staging: Configure staging environment variables
- Production: Set up production database and auth secrets
The app uses Better Auth for authentication with the following features:
- Email/password authentication
- Session management
- Protected routes
- User-specific text management
The backend provides the following tRPC procedures:
texts.create- Create a new texttexts.createAnonymous- Create anonymous texttexts.getById- Get text by IDtexts.getAll- Get paginated public textstexts.delete- Delete a text (owner only)
auth.signUp- User registrationauth.signIn- User loginauth.signOut- User logoutauth.getSession- Get current session
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Run tests:
npm run check-types - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue on the GitHub repository or contact the maintainers.
- Built with Better-T-Stack
- UI components from shadcn/ui
- Icons from Lucide React
- Deployed on Cloudflare Workers