{"id":24599666,"url":"https://github.com/emrekardaslar/astro-preact","last_synced_at":"2026-04-17T12:31:20.057Z","repository":{"id":273988230,"uuid":"921546169","full_name":"emrekardaslar/astro-preact","owner":"emrekardaslar","description":"Astro + Preact","archived":false,"fork":false,"pushed_at":"2025-01-24T06:47:30.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T06:33:11.609Z","etag":null,"topics":["astro","preact","ssr"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/emrekardaslar.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-01-24T06:36:11.000Z","updated_at":"2025-01-24T07:08:16.000Z","dependencies_parsed_at":"2025-01-24T07:37:35.212Z","dependency_job_id":null,"html_url":"https://github.com/emrekardaslar/astro-preact","commit_stats":null,"previous_names":["emrekardaslar/astro-preact"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emrekardaslar/astro-preact","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrekardaslar%2Fastro-preact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrekardaslar%2Fastro-preact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrekardaslar%2Fastro-preact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrekardaslar%2Fastro-preact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emrekardaslar","download_url":"https://codeload.github.com/emrekardaslar/astro-preact/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrekardaslar%2Fastro-preact/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31929495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["astro","preact","ssr"],"created_at":"2025-01-24T13:16:42.169Z","updated_at":"2026-04-17T12:31:20.038Z","avatar_url":"https://github.com/emrekardaslar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Astro + Preact Counter with State Management\n\nThis is an example project using Astro and Preact to demonstrate state management with `useContext` and `useReducer`. The application includes a simple counter with a modular structure for actions and reducers.\n\n## Project Structure\n\n```\nsrc/\n  actions/\n    counterActions.js          # Action types for the counter\n  reducers/\n    counterReducer.js          # Reducer logic for the counter\n  components/\n    Counter.jsx                # Counter buttons to increment, decrement, and reset\n    CounterDisplay.jsx         # Displays the current count\n    ReactIsland.jsx            # Wrapper for CounterProvider and interactive components\n  contexts/\n    CounterContext.jsx         # Context and provider for state management\n  pages/\n    index.astro                # Main page wrapping the ReactIsland component\n```\n\n## Features\n\n- **Astro Integration**: Uses Astro's partial hydration feature to render Preact components.\n- **State Management**: Implements `useContext` and `useReducer` for clean and reusable state management.\n- **Modular Design**: Separates actions and reducers into dedicated folders for scalability.\n\n## Getting Started\n\n### Prerequisites\n\nEnsure you have the following installed:\n\n- [Node.js](https://nodejs.org/) (v16 or later)\n- npm (comes with Node.js)\n\n### Installation\n\n1. Clone the repository:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd \u003cproject-folder\u003e\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Start the development server:\n   ```bash\n   npm run dev\n   ```\n\n4. Open the app in your browser:\n   ```\n   http://localhost:3000\n   ```\n\n## Usage\n\nThe app provides a simple counter with three buttons:\n\n- `+`: Increment the counter.\n- `-`: Decrement the counter.\n- `Reset`: Reset the counter to `0`.\n\nThe state is managed using `useReducer` and shared via `useContext` within the `CounterProvider`.\n\n## Folder Highlights\n\n### `actions/`\nDefines reusable action types (e.g., `INCREMENT`, `DECREMENT`, `RESET`).\n\n### `reducers/`\nContains the logic to handle state transitions based on dispatched actions.\n\n### `contexts/`\nDefines the `CounterContext` and `CounterProvider` to encapsulate and share state across components.\n\n## Contributing\n\nFeel free to submit issues or contribute to the project with pull requests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femrekardaslar%2Fastro-preact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femrekardaslar%2Fastro-preact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femrekardaslar%2Fastro-preact/lists"}