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 @@
1 1
2# Awesome Privacy API 2# Awesome Privacy API
3 3
4The API allows you to consume the Awesome Privacy data pragmatically. 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.
5It also fetches and exposes additional data for each listing to add context.
6 5
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.
7 8
8## Usage 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.
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.
11 10
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
13Start by cloning the repo `git clone git@github.com:lissy93/awesome-privacy.git` then `cd awesome-privacy/api` 35Start by cloning the repo `git clone git@github.com:lissy93/awesome-privacy.git` then `cd awesome-privacy/api`
14 36
151. `bun install` - Install dependencies 371. `bun install` - Install dependencies
@@ -20,13 +42,51 @@ Or, to build + run the Docker container, use:
201. `docker build -t awesome-privacy-api .` 421. `docker build -t awesome-privacy-api .`
212. `docker run -p 8787:8787 --env-file .env awesome-privacy-api` 432. `docker run -p 8787:8787 --env-file .env awesome-privacy-api`
22 44
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
24 51
25#### Option 1: Docker 52---
53
54## Deployment
26 55
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`
28 58
29#### Option 2: Bare Metal 59#### Option 2: Bare Metal
30Follow the [development](#development) setup above, then run `bun start` to start the production server on `:8787` 60Follow the [development](#development) setup above, then run `bun start` to start the production server on `:8787`
31 61
32#### Option 3: Cloudflare 62#### 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 = () => {
87 > There's also many real privacy issues which the automated lookups have no way of detecting, 87 > There's also many real privacy issues which the automated lookups have no way of detecting,
88 > as well as the possibility for false positives/negatives. 88 > as well as the possibility for false positives/negatives.
89 > **Always do your own research**. 89 > **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
90 ` 113 `
91 114
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
92 // OpenAPI document plus Scalar UI 118 // OpenAPI document plus Scalar UI
93 app.doc('/openapi.json', { 119 app.doc('/openapi.json', {
94 openapi: '3.0.0', 120 openapi: '3.0.0',
@@ -99,11 +125,8 @@ export const buildApp = () => {
99 }, 125 },
100 servers: [{ url: '/' }], 126 servers: [{ url: '/' }],
101 tags: [ 127 tags: [
102 { name: 'Public', description: 'Open, cached, served from the local dataset' }, 128 { name: 'Public', description: publicDescription },
103 { 129 { name: 'Enrichment', description: enrichDescription },
104 name: 'Enrichment',
105 description: 'Bearer-auth routes that proxy + cache third-party data',
106 },
107 ], 130 ],
108 }) 131 })
109 const blurb = 'Browse awesome-privacy data and enrichment insights programmatically.' 132 const blurb = 'Browse awesome-privacy data and enrichment insights programmatically.'
@@ -115,7 +138,6 @@ export const buildApp = () => {
115 persistAuth: true, 138 persistAuth: true,
116 favicon: 'https://awesome-privacy.xyz/favicon.svg', 139 favicon: 'https://awesome-privacy.xyz/favicon.svg',
117 operationTitleSource: 'summary', 140 operationTitleSource: 'summary',
118 tagsSorter: 'alpha',
119 operationsSorter: 'alpha', 141 operationsSorter: 'alpha',
120 orderRequiredPropertiesFirst: true, 142 orderRequiredPropertiesFirst: true,
121 mcp: { name: 'Awesome Privacy', url: '/v1/mcp' }, 143 mcp: { name: 'Awesome Privacy', url: '/v1/mcp' },
api/src/routes/public/categories.ts +3 −3
@@ -25,7 +25,7 @@ const listCategories = createRoute({
25 method: 'get', 25 method: 'get',
26 path: '/categories', 26 path: '/categories',
27 tags: ['Public'], 27 tags: ['Public'],
28 summary: 'List all categories with section summaries', 28 summary: 'List categories',
29 responses: { 29 responses: {
30 200: Ok(ListEnvelope(CategorySchema)), 30 200: Ok(ListEnvelope(CategorySchema)),
31 }, 31 },
@@ -48,7 +48,7 @@ const oneCategory = createRoute({
48 method: 'get', 48 method: 'get',
49 path: '/categories/{slug}', 49 path: '/categories/{slug}',
50 tags: ['Public'], 50 tags: ['Public'],
51 summary: 'One category by slug', 51 summary: 'Get category',
52 request: { params: z.object({ slug: z.string() }) }, 52 request: { params: z.object({ slug: z.string() }) },
53 responses: { 53 responses: {
54 200: Ok(Envelope(CategorySchema)), 54 200: Ok(Envelope(CategorySchema)),
@@ -76,7 +76,7 @@ const oneSection = createRoute({
76 method: 'get', 76 method: 'get',
77 path: '/sections/{slug}', 77 path: '/sections/{slug}',
78 tags: ['Public'], 78 tags: ['Public'],
79 summary: 'One section by slug, with services', 79 summary: 'Get section',
80 request: { params: z.object({ slug: z.string() }) }, 80 request: { params: z.object({ slug: z.string() }) },
81 responses: { 81 responses: {
82 200: Ok(Envelope(SectionSchema)), 82 200: Ok(Envelope(SectionSchema)),
api/src/routes/public/search.ts +1 −1
@@ -15,7 +15,7 @@ const route = createRoute({
15 method: 'get', 15 method: 'get',
16 path: '/search', 16 path: '/search',
17 tags: ['Public'], 17 tags: ['Public'],
18 summary: 'Full-text search across services', 18 summary: 'Search',
19 request: { query: querySchema }, 19 request: { query: querySchema },
20 responses: { 20 responses: {
21 200: Ok(ListEnvelope(SearchHitSchema)), 21 200: Ok(ListEnvelope(SearchHitSchema)),
api/src/routes/public/services.ts +2 −2
@@ -11,7 +11,7 @@ const listRoute = createRoute({
11 method: 'get', 11 method: 'get',
12 path: '/services', 12 path: '/services',
13 tags: ['Public'], 13 tags: ['Public'],
14 summary: 'List services with filters and pagination', 14 summary: 'List services',
15 request: { 15 request: {
16 query: z.object({ 16 query: z.object({
17 category: z.string().optional(), 17 category: z.string().optional(),
@@ -48,7 +48,7 @@ const oneRoute = createRoute({
48 method: 'get', 48 method: 'get',
49 path: '/services/{slug}', 49 path: '/services/{slug}',
50 tags: ['Public'], 50 tags: ['Public'],
51 summary: 'One service by slug', 51 summary: 'Get service',
52 request: { params: z.object({ slug: z.string() }) }, 52 request: { params: z.object({ slug: z.string() }) },
53 responses: { 53 responses: {
54 200: Ok(Envelope(FlatServiceSchema)), 54 200: Ok(Envelope(FlatServiceSchema)),
api/src/routes/public/stats.ts +2 −2
@@ -10,7 +10,7 @@ const statsRoute = createRoute({
10 method: 'get', 10 method: 'get',
11 path: '/stats', 11 path: '/stats',
12 tags: ['Public'], 12 tags: ['Public'],
13 summary: 'Dataset-wide counts', 13 summary: 'Stats',
14 responses: { 200: Ok(Envelope(StatsSchema)) }, 14 responses: { 200: Ok(Envelope(StatsSchema)) },
15}) 15})
16 16
@@ -20,7 +20,7 @@ const healthRoute = createRoute({
20 method: 'get', 20 method: 'get',
21 path: '/health', 21 path: '/health',
22 tags: ['Public'], 22 tags: ['Public'],
23 summary: 'Liveness check', 23 summary: 'Health',
24 responses: { 200: Ok(Envelope(HealthSchema)) }, 24 responses: { 200: Ok(Envelope(HealthSchema)) },
25}) 25})
26 26