{"id":26696383,"url":"https://github.com/dashpilot/astro-sqlite-blog","last_synced_at":"2025-03-26T20:20:07.285Z","repository":{"id":282975128,"uuid":"950274558","full_name":"dashpilot/astro-sqlite-blog","owner":"dashpilot","description":"An Astro Blog CMS system powered by SQLite (or Turso) with secure auth","archived":false,"fork":false,"pushed_at":"2025-03-17T23:23:07.000Z","size":602,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T00:25:56.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Astro","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dashpilot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-17T22:53:47.000Z","updated_at":"2025-03-17T23:23:10.000Z","dependencies_parsed_at":"2025-03-18T00:26:05.172Z","dependency_job_id":"8256776a-84d6-4682-9419-810a1eaa3270","html_url":"https://github.com/dashpilot/astro-sqlite-blog","commit_stats":null,"previous_names":["dashpilot/astro-sqlite-blog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpilot%2Fastro-sqlite-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpilot%2Fastro-sqlite-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpilot%2Fastro-sqlite-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpilot%2Fastro-sqlite-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashpilot","download_url":"https://codeload.github.com/dashpilot/astro-sqlite-blog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245727749,"owners_count":20662558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-26T20:20:06.719Z","updated_at":"2025-03-26T20:20:07.277Z","avatar_url":"https://github.com/dashpilot.png","language":"Astro","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Astro Blog System with SQLite/Turso\n\nAn Astro blog CMS system powered by SQLite (locally/VPS) or Turso (for serverless deployments).\n\n## Features\n\n-   🚀 Ultra-fast performance with local SQLite\n-   🔐 Secure cookie-based sessions\n-   🔄 Seamless transition to serverless with Turso\n-   👤 User authentication with JWT\n-   ✏️ Markdown post editor with preview\n-   📱 Responsive design with Tailwind CSS\n\n## Preview\n\n\u003cimg src=\"preview.png\" /\u003e\n\n## Getting Started\n\n### Prerequisites\n\n-   Node.js 16 or newer\n-   npm or yarn\n\n### Installation\n\n1. Clone this repository:\n\n    ```bash\n    git clone https://github.com/yourusername/astro-libsql-blog.git\n    cd astro-libsql-blog\n    ```\n\n2. Install dependencies:\n\n    ```bash\n    npm install\n    ```\n\n3. Initialize the database:\n\n    ```bash\n    npm run init-db\n    ```\n\n4. Start the development server:\n    ```bash\n    npm run dev\n    ```\n\nYour blog should now be running at `http://localhost:4321`\n\n## Database Setup\n\n### Local SQLite (Default)\n\nBy default, the application uses a local SQLite database file. This configuration offers the best performance for self-hosted environments.\n\nThe database connection is configured in `src/lib/db.js`:\n\n```javascript\n// src/lib/db.js\nimport { createClient } from '@libsql/client';\n\nexport const db = createClient({\n    url: 'file:local.db',\n});\n```\n\n### Using Turso for Serverless\n\nTo use Turso as your database for serverless deployments:\n\n1. Sign up for a Turso account at [turso.tech](https://turso.tech)\n2. Create a new database in the Turso dashboard\n3. Get your database URL and authentication token\n4. Update your database configuration:\n\n```javascript\n// src/lib/db.js\nimport { createClient } from '@libsql/client';\n\nexport const db = createClient({\n    url: process.env.DATABASE_URL || 'file:local.db',\n    authToken: process.env.DATABASE_AUTH_TOKEN,\n});\n```\n\n5. Set the environment variables `DATABASE_URL` and `DATABASE_AUTH_TOKEN` in your deployment environment\n\n## Database Initialization\n\nThe application requires tables for users, posts, and sessions. To initialize these tables:\n\n1. Make sure the initialization script is properly configured in your package.json:\n\n    ```json\n    \"scripts\": {\n      \"init-db\": \"node --experimental-specifier-resolution=node --loader ts-node/esm src/scripts/init-db.js\"\n    }\n    ```\n\n2. Run the initialization script:\n    ```bash\n    npm run init-db\n    ```\n\nIf using Turso, the same initialization script will work with the remote database when you've configured the connection properly with environment variables.\n\n## Deployment\n\n### Building for Production\n\n```bash\nnpm run build\n```\n\nThis will create a `dist` directory containing your production-ready application.\n\n### Deploying on a VPS/Plesk\n\nWhen deploying to a VPS with Plesk:\n\n1. Set the **application root** to the project root directory (where package.json is located)\n2. Set the document root appropriately (typically to `dist/client` for Astro SSR)\n3. Make sure your Node.js version is compatible (v16+)\n4. Install dependencies on the server with `npm install`\n5. Start the application using the appropriate startup file\n\n### Deploying on Serverless\n\nFor serverless deployment:\n\n1. Configure your database to use Turso\n2. Set the required environment variables\n3. Follow the deployment instructions for your serverless platform (Vercel, Netlify, etc.)\n\n## Security Considerations\n\nFor production:\n\n1. Change the JWT secret in `src/lib/auth.js` to a secure random string\n2. Ensure HTTPS is enabled for your domain\n3. Set appropriate cookie security options for production\n4. Back up your SQLite database file regularly (if using local SQLite)\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashpilot%2Fastro-sqlite-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashpilot%2Fastro-sqlite-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashpilot%2Fastro-sqlite-blog/lists"}