Commit 592f79be7b

592f79be7bceea7ecbb355a29c17ef094b88a6d6

parent: 62f6a1e47d

Unsigned

Alicia Sykes <alicia@omg.lol> · 2026-06-07 20:00 UTC

Adds docs for new API

Layout: unified · split

api/README.md +69 −9
@@ -1,15 +1,37 @@
11
22# Awesome Privacy API
33
4The API allows you to consume the Awesome Privacy data pragmatically.
5It also fetches and exposes additional data for each listing to add context.
4The API allows you to browse awesome-privacy's data programmatically. It also runs some lookups/checks on listings to surface useful insights to add additional context to listings, and save time when comparing software / services.
65
6> [!IMPORTANT]
7> It's very important not to rely on this data for any decision making, as it only gives a very narrow slice of the picture. There's also many real privacy issues which the automated lookups have no way of detecting, as well as the possibility for false positives/negatives. Always do your own research.
78
8## Usage
9You are free to use the managed instance (`api.awesome-privacy.xyz`) however you like.
10Or, run it locally or deploy your own instance by following the [Deployment](#deployment) steps below.
9These endpoints are used by as part of the website generation, the PR review process and the scheduled listing audits. You're also free to use it for your own purposes.
1110
12### Development
11## Endpoints
12
13For a full list of endpoints and usage, see the [API Docs](https://api.awesome-privacy.xyz) or download the [`openapi.json`](https://api.awesome-privacy.xyz/openapi.json).
14
15Listing data
16- Categories
17- Sections
18- Listings
19- Search
20- Stats
21
22Enrichment data
23- Privacy policy summary, score and data
24- Known security vulnerabilities and scorecard
25- GitHub repo health, license, versioning, contributors, etc
26- Android trackers, permissions and de-googled compatibility
27- iOS app versioning, size, reviews and info
28- Docker container info
29- Website security and hosting summary
30- Community overview, from Discord, Reddit and Mastadon
31
32---
33
34## Development
1335Start by cloning the repo `git clone git@github.com:lissy93/awesome-privacy.git` then `cd awesome-privacy/api`
1436
15371. `bun install` - Install dependencies
@@ -20,13 +42,51 @@ Or, to build + run the Docker container, use:
20421. `docker build -t awesome-privacy-api .`
21432. `docker run -p 8787:8787 --env-file .env awesome-privacy-api`
2244
23### Deployment
45Before committing, make sure all checks pass:
46- `bun run lint` - Linting
47- `bun run typecheck` - TS typechecking
48- `bun run format:check` - Check formatting
49- `bun run test` - Run the test suite
50- `bun run smoke` - Quick smoke test
2451
25#### Option 1: Docker
52---
53
54## Deployment
2655
27`docker run lissy93/awesome-privacy-api`
56#### Option 1: Docker
57Use `docker run -p 9000:8787 lissy93/awesome-privacy-api`, then pop open `localhost:9000`
2858
2959#### Option 2: Bare Metal
3060Follow the [development](#development) setup above, then run `bun start` to start the production server on `:8787`
3161
3262#### Option 3: Cloudflare
63Run `bun run deploy`. You'll need wrangler, and to be authenticated.
64
65<details>
66<summary>authenticating</summary>
67
68I recommend you use API token for this, as then you can scope it as narrowly as possible.<br>
69Head to [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens), then create one just like shown below.<br>
70Then, set `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` env vars in the context you run deploy in.
71
72![creating api token](https://pixelflare.cc/alicia/screenshots/cloudflare-api-token-for-awesome-privacy)
73
74</details>
75
76---
77
78## Configuring
79By default no extra config needed.
80
81#### Authentication
82All endpoints are publicly exposed by default. You can change this, by setting an `API_TOKEN` env var, which will then require the `Authorization: Bearer <token>` header on the `/enrich/*` endpoints.
83
84#### Caching
85If a KV is configured, then results from the enrich endpoints can be cached for a configurable amount of time once a success response if returned. This reduces load on upstream services.
86
87#### Third-party fetching
88Some of the enrich endpoints can also fetch from upstream providers to get some additional context. Some of these need API keys, if these keys aren't present, then those checks will just be skipped.
89- `DISCORD_BOT_TOKEN`
90- `APIVOID_API_KEY`
91- `EXODUS_TOKEN`
92- `GITHUB_TOKEN`
api/src/app.ts +28 −6
@@ -87,8 +87,34 @@ export const buildApp = () => {
8787 > There's also many real privacy issues which the automated lookups have no way of detecting,
8888 > as well as the possibility for false positives/negatives.
8989 > **Always do your own research**.
90
91<details>
92<summary>Authenticating</summary>
93
94By default, no auth is needed.
95If you're self-hosting, you can enable auth by setting the \`API_KEY\` env var.
96Then, add the \`Authorization: Bearer <your-token>\` header when accessing the enrichment endpoints.
97</details>
98
99<details>
100<summary>Caching</summary>
101
102Some responses are cached to reduce load on upstream services.
103When configured, successful enrichment data results are put in KV for upto 7 days.
104</details>
105
106<details>
107<summary>Self-Hosting</summary>
108
109See the [repo](https://github.com/lissy93/awesome-privacy/tree/main/api) for
110deployment and development guides, as well as instructions for self-hosting, contributing and usage.
111</details>
112
90113 `
91114
115 const publicDescription = 'Endpoints to browse the awesome-privacy dataset programatically';
116 const enrichDescription = 'Endpoints to fetch additional data about listings from external sources';
117
92118 // OpenAPI document plus Scalar UI
93119 app.doc('/openapi.json', {
94120 openapi: '3.0.0',
@@ -99,11 +125,8 @@ export const buildApp = () => {
99125 },
100126 servers: [{ url: '/' }],
101127 tags: [
102 { name: 'Public', description: 'Open, cached, served from the local dataset' },
103 {
104 name: 'Enrichment',
105 description: 'Bearer-auth routes that proxy + cache third-party data',
106 },
128 { name: 'Public', description: publicDescription },
129 { name: 'Enrichment', description: enrichDescription },
107130 ],
108131 })
109132 const blurb = 'Browse awesome-privacy data and enrichment insights programmatically.'
@@ -115,7 +138,6 @@ export const buildApp = () => {
115138 persistAuth: true,
116139 favicon: 'https://awesome-privacy.xyz/favicon.svg',
117140 operationTitleSource: 'summary',
118 tagsSorter: 'alpha',
119141 operationsSorter: 'alpha',
120142 orderRequiredPropertiesFirst: true,
121143 mcp: { name: 'Awesome Privacy', url: '/v1/mcp' },
api/src/routes/public/categories.ts +3 −3
@@ -25,7 +25,7 @@ const listCategories = createRoute({
2525 method: 'get',
2626 path: '/categories',
2727 tags: ['Public'],
28 summary: 'List all categories with section summaries',
28 summary: 'List categories',
2929 responses: {
3030 200: Ok(ListEnvelope(CategorySchema)),
3131 },
@@ -48,7 +48,7 @@ const oneCategory = createRoute({
4848 method: 'get',
4949 path: '/categories/{slug}',
5050 tags: ['Public'],
51 summary: 'One category by slug',
51 summary: 'Get category',
5252 request: { params: z.object({ slug: z.string() }) },
5353 responses: {
5454 200: Ok(Envelope(CategorySchema)),
@@ -76,7 +76,7 @@ const oneSection = createRoute({
7676 method: 'get',
7777 path: '/sections/{slug}',
7878 tags: ['Public'],
79 summary: 'One section by slug, with services',
79 summary: 'Get section',
8080 request: { params: z.object({ slug: z.string() }) },
8181 responses: {
8282 200: Ok(Envelope(SectionSchema)),
api/src/routes/public/search.ts +1 −1
@@ -15,7 +15,7 @@ const route = createRoute({
1515 method: 'get',
1616 path: '/search',
1717 tags: ['Public'],
18 summary: 'Full-text search across services',
18 summary: 'Search',
1919 request: { query: querySchema },
2020 responses: {
2121 200: Ok(ListEnvelope(SearchHitSchema)),
api/src/routes/public/services.ts +2 −2
@@ -11,7 +11,7 @@ const listRoute = createRoute({
1111 method: 'get',
1212 path: '/services',
1313 tags: ['Public'],
14 summary: 'List services with filters and pagination',
14 summary: 'List services',
1515 request: {
1616 query: z.object({
1717 category: z.string().optional(),
@@ -48,7 +48,7 @@ const oneRoute = createRoute({
4848 method: 'get',
4949 path: '/services/{slug}',
5050 tags: ['Public'],
51 summary: 'One service by slug',
51 summary: 'Get service',
5252 request: { params: z.object({ slug: z.string() }) },
5353 responses: {
5454 200: Ok(Envelope(FlatServiceSchema)),
api/src/routes/public/stats.ts +2 −2
@@ -10,7 +10,7 @@ const statsRoute = createRoute({
1010 method: 'get',
1111 path: '/stats',
1212 tags: ['Public'],
13 summary: 'Dataset-wide counts',
13 summary: 'Stats',
1414 responses: { 200: Ok(Envelope(StatsSchema)) },
1515})
1616
@@ -20,7 +20,7 @@ const healthRoute = createRoute({
2020 method: 'get',
2121 path: '/health',
2222 tags: ['Public'],
23 summary: 'Liveness check',
23 summary: 'Health',
2424 responses: { 200: Ok(Envelope(HealthSchema)) },
2525})
2626