diff --git a/README.md b/README.md new file mode 100644 index 0000000..dfa2e34 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# SharpbinV3 + +Sharpbin is a pastebin-style website built with ASP.NET Core and SvelteKit. + +## Features + +- User authentication and account management. +- Syntax highlighting for various programming languages. +- Private pastes with client-side encryption. +- Raw text serving for easy sharing and scripting. +- Paste editing including content, syntax, title, and expiration. +- Configurable paste expiration. +- Server-side paste compression to save storage. +- Captcha support via Cloudflare Turnstile. + +## Project Structure + +- **[SharpbinV3.Server](SharpbinV3.Server/README.md)**: Backend API built with C# and ASP.NET Core. Refer to its README for server-side development and configuration. +- **[SharpbinV3.Client](SharpbinV3.Client/README.md)**: Frontend application built with SvelteKit and TypeScript. Refer to its README for client-side development and setup. + +## Getting Started + +The easiest way to run SharpbinV3 is using Docker Compose. + +1. Ensure Docker and Docker Compose are installed. +2. Clone the repository. +```bash +git clone https://github.com/whoswhip/Sharpbin.git +``` +3. Run the following command in the root directory: + +```bash +docker-compose up -d +``` + +The frontend will be accessible at http://localhost:5173. diff --git a/SharpbinV3.Client/README.md b/SharpbinV3.Client/README.md index 75842c4..2e9282d 100644 --- a/SharpbinV3.Client/README.md +++ b/SharpbinV3.Client/README.md @@ -1,38 +1,54 @@ -# sv +# SharpbinV3 Client -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). +This is the SvelteKit frontend for SharpbinV3. -## Creating a project +## Development Setup -If you're seeing this, you've probably already done this step. Congrats! +### Prerequisites -```sh -# create a new project in the current directory -npx sv create +- Node.js (v20 or newer recommended) +- npm -# create a new project in my-app -npx sv create my-app +### Installation + +Install the project dependencies: + +```bash +npm install ``` -## Developing +### Environment Configuration -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: +The application requires an environment variable to point to the backend API. Create a `.env` file in this directory or set the variable in your environment: -```sh +```env +VITE_API_URL=http://localhost:8080 +``` + +### Running in Development + +Start the development server with Hot Module Replacement (HMR): + +```bash npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open ``` -## Building +The application will be available at http://localhost:5173. -To create a production version of your app: +## Script Reference -```sh -npm run build -``` +- `npm run dev`: Start the Vite development server. +- `npm run build`: Create a production build of the application. +- `npm run preview`: Locally preview the production build. +- `npm run check`: Run type checking with svelte-check. +- `npm run lint`: Run ESLint and Prettier checks. +- `npm run format`: Format the codebase with Prettier. -You can preview the production build with `npm run preview`. +## Tech Stack + +- Svelte 5 with SvelteKit. +- Tailwind CSS for styling. +- Lucide Svelte for icons. +- Highlight.js for syntax highlighting. +- TypeScript for type safety. -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. diff --git a/SharpbinV3.Server/README.md b/SharpbinV3.Server/README.md new file mode 100644 index 0000000..b04a45c --- /dev/null +++ b/SharpbinV3.Server/README.md @@ -0,0 +1,45 @@ +# SharpbinV3 Server + +This is the backend API for SharpbinV3, built with ASP.NET Core and Entity Framework Core. + +## Development Setup + +### Prerequisites + +- .NET 10 SDK +- Entity Framework Core Tools (`dotnet tool install --global dotnet-ef`) + +### Configuration + +The server configuration is managed in `appsettings.json`. For development, ensure you have set the following in `appsettings.Development.json` or as environment variables: + +- `ConnectionStrings:DefaultConnection`: The SQLite connection string (e.g., `Data Source=sharpbin.db`). +- `JwtSettings:Secret`: A secure key for JWT signing. +- `CloudflareSettings:TurnstileSecret`: Your Cloudflare Turnstile secret key (if using captcha). + +### Database Migrations + +Apply the database migrations to initialize the SQLite database: + +```bash +dotnet ef database update +``` + +### Running in Development + +Use the following command to run the server with hot reload: + +```bash +dotnet watch run +``` + +The API will be accessible at http://localhost:8080 by default (check `Properties/launchSettings.json` or your specific configuration). + +## Tech Stack + +- ASP.NET Core (Web API) +- Entity Framework Core with SQLite +- JWT Authentication +- BCrypt for password hashing +- Health Checks for monitoring +- Swagger/OpenAPI for documentation