1- <!--
2- Copyright (c) 2025 Foia Stream
3-
4- Permission is hereby granted, free of charge, to any person obtaining a copy
5- of this software and associated documentation files (the "Software"), to deal
6- in the Software without restriction, including without limitation the rights
7- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8- copies of the Software, and to permit persons to whom the Software is
9- furnished to do so, subject to the following conditions:
10-
11- The above copyright notice and this permission notice shall be included in all
12- copies or substantial portions of the Software.
13-
14- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20- SOFTWARE.
21- -->
22-
231<!--
242 Generated by AI-Powered README Generator
253 Repository: https://github.com/WomB0ComB0/foia-stream
26- Generated: 2025-12-25T02:23:02.364Z
4+ Generated: 2025-12-26T03:02:48.379Z
275 Format: md
286 Style: comprehensive
297-->
@@ -139,7 +117,27 @@ graph LR
139117 Services --> Storage
140118```
141119
142- ### Technology Stack breakdown
120+ ### Core Request Flow
121+
122+ ``` mermaid
123+ sequenceDiagram
124+ participant User
125+ participant Frontend
126+ participant API
127+ participant DB
128+ participant Mailer
129+
130+ User->>Frontend: Submit FOIA Request
131+ Frontend->>API: POST /api/requests
132+ API->>API: Validate Schema (Zod)
133+ API->>DB: Persist Request (Status: Pending)
134+ API->>Mailer: Queue Submission Email to Agency
135+ Mailer-->>API: Email Sent Confirmation
136+ API-->>Frontend: 201 Created
137+ Frontend-->>User: Show Tracking Dashboard
138+ ```
139+
140+ ### Technology Stack
143141
144142| Component | Technology | Description |
145143| :--- | :--- | :--- |
@@ -173,8 +171,8 @@ graph LR
1731712 . ** Environment Configuration:**
174172 Copy the example environment file and fill in your secrets.
175173 ``` bash
176- cp .env.example .env
177- # Also check apps/api/.env and apps/astro/.env
174+ cp apps/api/ .env.example apps/api/ .env
175+ # Update variables in apps/api/.env and apps/astro/.env
178176 ```
179177
1801783 . ** Database Migration:**
@@ -194,58 +192,44 @@ graph LR
194192
195193| Command | Action |
196194| :--- | :--- |
197- | ` bun run dev ` | Starts both API and Astro frontend in parallel. |
195+ | ` bun run dev ` | Starts both API and Astro frontend in parallel via Turbo . |
198196| ` bun run build ` | Compiles the entire monorepo for production. |
199197| ` bun run test ` | Executes the Vitest suite across all packages. |
200- | ` bun run lint ` | Runs Biome for formatting and linting. |
198+ | ` bun run lint ` | Runs Biome for formatting and linting check . |
201199
202200[ Back to top ↑] ( #-table-of-contents )
203201
204202---
205203
206204## 📖 Usage & Workflows
207205
208- ### The Request Lifecycle
209-
210- ``` mermaid
211- sequenceDiagram
212- participant User
213- participant App as FOIA Stream
214- participant Agency as Government Agency
215-
216- User->>App: Select Template (e.g. Body Cam)
217- User->>App: Select Agency (e.g. LAPD)
218- App->>App: Generate Legal Language
219- User->>App: Click "Submit Request"
220- App->>Agency: Dispatch Email/API Request
221- App->>App: Initialize Deadline Tracker (20 Days)
222- Note over App: Monitoring...
223- Agency-->>App: Responsive Records Provided
224- App-->>User: Notification: "Records Ready for Review"
206+ ### 1. Creating a Request
207+ 1 . Navigate to the ** Dashboard** .
208+ 2 . Click ** New Request** .
209+ 3 . Search for an ** Agency** (e.g., "Chicago PD").
210+ 4 . Select a ** Template** (e.g., "Standard Records Request").
211+ 5 . Review the auto-generated legal text and click ** Submit** .
212+
213+ ### 2. Managing Documents
214+ The Document Viewer supports inline PDF viewing and redaction verification.
215+ ``` typescript
216+ // Example: Fetching request details via the API
217+ const response = await fetch (' /api/requests/req_12345' , {
218+ headers: { ' Authorization' : ` Bearer ${token } ` }
219+ });
220+ const data = await response .json ();
221+ console .log (data .status ); // "Fulfillment_In_Progress"
225222```
226223
227- ### Common Commands (API)
228- The API is fully documented. Here are the primary interaction patterns:
229-
224+ ### 3. Redaction Workflow
230225<details >
231- <summary ><b >View API Examples (cURL)</b ></summary >
232-
233- ** Create a Request:**
234- ``` bash
235- curl -X POST http://localhost:3000/api/v1/requests \
236- -H " Authorization: Bearer $TOKEN " \
237- -H " Content-Type: application/json" \
238- -d ' {
239- "agencyId": "uuid-123",
240- "templateId": "body-cam-standard",
241- "description": "Footage from 12/25 incident at Main St."
242- }'
243- ```
226+ <summary ><b >View Redaction Process</b ></summary >
244227
245- ** Check Agency Stats:**
246- ``` bash
247- curl http://localhost:3000/api/v1/agencies/stats
248- ```
228+ The system includes a ` pdf-redaction.service.ts ` that uses ` pdf-lib ` to overlay black boxes on sensitive coordinates before public disclosure.
229+ 1 . Upload Document.
230+ 2 . Select text/areas for redaction.
231+ 3 . Service generates a "Sanitized" version.
232+ 4 . Audit log records who performed the redaction and why.
249233</details >
250234
251235[ Back to top ↑] ( #-table-of-contents )
@@ -254,37 +238,37 @@ curl http://localhost:3000/api/v1/agencies/stats
254238
255239## 🔐 Security & Compliance
256240
257- This repository includes a dedicated ` /compliance ` directory containing rigorous documentation for production environments .
241+ FOIA Stream is designed with strict data handling policies, as detailed in our ` /compliance ` directory .
258242
259- - ** 🔍 Audit Logging:** Every database mutation is tracked with a user ID and timestamp.
260- - ** 🛡️ Rate Limiting:** Built-in middleware protects the API from brute-force and DDoS attempts.
261- - ** 📄 Policies:** See ` compliance/privacy/data-retention-policy.md ` for details on how we handle PII.
262- - ** ☣️ Security Monitoring:** Integrated with GitHub Actions and ZAP rules for vulnerability scanning.
243+ - ** PII Protection:** All Personally Identifiable Information is encrypted at rest using AES-256-GCM.
244+ - ** Rate Limiting:** Built-in Hono middleware prevents scraping or brute-force attacks on agency endpoints.
245+ - ** Audit Logging:** Every interaction with a record is timestamped and attributed to a specific user ID.
246+ - ** Compliance Documentation:**
247+ - [ Data Retention Policy] ( ./compliance/privacy/data-retention-policy.md )
248+ - [ Privacy Impact Assessment] ( ./compliance/privacy/privacy-impact-assessment.md )
249+ - [ Incident Response Runbook] ( ./compliance/runbooks/incident-response.md )
263250
264- | Feature | Implementation |
265- | :--- | :--- |
266- | ** Auth** | JWT with short-lived tokens + Refresh tokens |
267- | ** Encryption** | AES-256-GCM for sensitive fields |
268- | ** MFA** | TOTP (Google Authenticator / Authy compatible) |
251+ ⚠️ ** Warning:** Ensure you rotate the ` ENCRYPTION_SECRET ` in your ` .env ` before deploying to a production environment.
269252
270253[ Back to top ↑] ( #-table-of-contents )
271254
272255---
273256
274257## 🛠️ Development & Contributing
275258
276- We welcome contributions from developers, legal experts, and transparency advocates.
259+ We welcome contributions from developers, legal experts, and UI designers.
260+
261+ ### Project Structure
262+ - ` apps/api ` : Hono backend with Drizzle/SQLite.
263+ - ` apps/astro ` : Astro frontend with React islands.
264+ - ` packages/shared ` : Shared Zod schemas and utility functions.
265+ - ` compliance/ ` : Legal frameworks and security policies.
277266
278267### Contribution Rules
2792681 . ** Branching:** Use ` feature/ ` or ` fix/ ` prefixes.
280- 2 . ** Code Quality:** All PRs must pass ` bun run lint ` (Biome) and ` bun run test ` .
281- 3 . ** Type Safety:** No ` any ` types. Use Zod schemas for all data boundaries.
282-
283- ### Project Structure
284- - ` apps/api ` : Hono backend, SQLite database, and business services.
285- - ` apps/astro ` : Frontend UI components and pages.
286- - ` packages/shared ` : Shared TypeScript types, Zod schemas, and utility functions.
287- - ` compliance/ ` : Policy documents and control catalogs.
269+ 2 . ** Linting:** Run ` bun run lint:fix ` before committing.
270+ 3 . ** Testing:** Ensure ` bun run test ` passes for all changed packages.
271+ 4 . ** Documentation:** Update relevant ` .md ` files if adding new features.
288272
289273[ Back to top ↑] ( #-table-of-contents )
290274
@@ -293,14 +277,14 @@ We welcome contributions from developers, legal experts, and transparency advoca
293277## 🗺️ Roadmap & Limitations
294278
295279### Current Limitations
296- - ⚠️ ** Jurisdictional Variance :** Currently optimized for US-based FOIA/Public Records laws .
297- - ⚠️ ** Manual Verification :** Some agency email addresses require manual verification before high-volume use .
280+ - ⚠️ ** Email Integration :** Currently requires a manual SMTP setup for automated agency dispatching .
281+ - ⚠️ ** File Size :** Uploads are limited to 50MB per document in the default configuration .
298282
299- ### Planned Enhancements
300- - [ ] ** AI-Aided Redaction :** Auto-detect common redaction patterns to help users appeal denials .
301- - [ ] ** Direct Portal Integrations :** API-based submission for common portals like GovQA .
302- - [ ] ** Mobile App:** React Native application for recording incidents and filing on-the-spot .
303- - [ ] ** PDF Scraping :** Automated extraction of data from non-searchable government PDFs .
283+ ### Future Enhancements
284+ - [ ] ** AI-Powered Extraction :** Automatically extract entities (dates, names, dollar amounts) from disclosed PDFs .
285+ - [ ] ** State-Specific Statutes :** Integration of all 50 US state FOIA response laws .
286+ - [ ] ** Mobile App:** React Native companion app for on-the-go request tracking .
287+ - [ ] ** Public API :** GraphQL interface for third-party transparency tools .
304288
305289[ Back to top ↑] ( #-table-of-contents )
306290
@@ -310,31 +294,26 @@ We welcome contributions from developers, legal experts, and transparency advoca
310294
311295Distributed under the ** MIT License** . See ` LICENSE ` for more information.
312296
313- ** Project Maintainer :** [ WomB0ComB0] ( https://github.com/WomB0ComB0 )
314- ** Security Issues :** Please report any security vulnerabilities directly to the maintainer via GitHub issues (marked private if possible) or via the contact info in ` SECURITY.md ` .
297+ ** Project Lead :** [ WomB0ComB0] ( https://github.com/WomB0ComB0 )
298+ ** Security Contact :** security@foia-stream.org
315299
316300---
317301
318302## ❓ FAQ & Troubleshooting
319303
320- ### Troubleshooting
321-
322- <details >
323- <summary ><b >Bun install is failing</b ></summary >
324- Ensure you are using Bun version 1.0 or higher. Run ` bun upgrade ` to get the latest version.
325- </details >
326-
327- <details >
328- <summary ><b >Database migration errors</b ></summary >
329- If the schema gets out of sync during development, you can reset the local database by deleting ` apps/api/data/foia-stream.db ` and re-running ` bun run db:push ` .
330- </details >
331-
332304### FAQ
305+ ** Q: Does this work with federal FOIA.gov?**
306+ A: Yes, FOIA Stream can be used to track federal requests, though direct API integration with FOIA.gov is planned for v1.2.
333307
334- ** Q: Does this actually send the emails to agencies ?**
335- A: In development mode, emails are logged to the console. In production, it integrates with SendGrid or AWS SES to dispatch legal requests .
308+ ** Q: Can I use PostgreSQL instead of SQLite ?**
309+ A: While Drizzle supports it, the current schema is optimized for SQLite. You would need to update ` drizzle.config.ts ` and the driver in ` db/index.ts ` .
336310
337- ** Q: Can I use this for state-level requests?**
338- A: Yes! FOIA Stream includes templates and logic for federal FOIA, state-level (e.g., CPRA in CA, OPRA in NJ), and local ordinances.
311+ ### Troubleshooting
312+ | Issue | Solution |
313+ | :--- | :--- |
314+ | ** Drizzle Migration Fails** | Delete the ` ./data/foia-stream.db ` and re-run ` db:push ` . |
315+ | ** Hydration Errors** | Ensure React components in Astro are marked with ` client:load ` or ` client:visible ` . |
316+ | ** Bun Type Errors** | Run ` bun add -d @types/bun ` to sync global types. |
339317
340- [ Back to top ↑] ( #-table-of-contents )
318+ ---
319+ * Built with ❤️ for the Open Government community.*
0 commit comments