grain.social is a photo sharing platform built on atproto.
grain.social
atproto
photography
appview
1import { defineConfig } from "@hatk/hatk/config";
2
3const isProd = process.env.NODE_ENV === "production";
4const prodDomain = process.env.RAILWAY_PUBLIC_DOMAIN;
5
6const grainScopes = [
7 "atproto",
8 "blob:image/*",
9 "repo:social.grain.gallery",
10 "repo:social.grain.gallery.item",
11 "repo:social.grain.photo",
12 "repo:social.grain.photo.exif",
13 "repo:social.grain.actor.profile",
14 "repo:social.grain.graph.follow",
15 "repo:social.grain.favorite",
16 "repo:social.grain.comment",
17 "repo:social.grain.story",
18 "repo:social.grain.graph.block",
19 "repo:app.bsky.feed.post?action=create",
20].join(" ");
21
22export default defineConfig({
23 relay: isProd ? "wss://bsky.network" : "ws://localhost:2583",
24 plc: isProd ? "https://plc.directory" : "http://localhost:2582",
25 port: 3000,
26 cdn: isProd
27 ? {
28 url: "https://cdn.grain.social",
29 key: process.env.CDN_KEY!,
30 salt: process.env.CDN_SALT!,
31 }
32 : null,
33 databaseEngine: "sqlite",
34 database: isProd ? "/data/grain.db" : "data/grain.db",
35 backfill: {
36 signalCollections: ["social.grain.actor.profile"],
37 fullNetwork: false,
38 parallelism: 5,
39 },
40 push: {
41 apns: {
42 keyFile: isProd ? "/data/certs/AuthKey_J53A95HDW7.p8" : "./certs/AuthKey_J53A95HDW7.p8",
43 keyId: "J53A95HDW7",
44 teamId: "YN68LN9T7Z",
45 bundleId: "social.grain.grain",
46 production: isProd,
47 },
48 },
49 oauth: {
50 issuer: isProd && prodDomain ? `https://${prodDomain}` : undefined,
51 scopes: grainScopes.split(" "),
52 clients: [
53 ...(prodDomain
54 ? [
55 {
56 client_id: `https://${prodDomain}/oauth-client-metadata.json`,
57 client_name: "grain",
58 scope: grainScopes,
59 redirect_uris: [
60 `https://${prodDomain}/oauth/callback`,
61 `https://${prodDomain}/admin`,
62 "grain://oauth/callback",
63 ],
64 },
65 ]
66 : []),
67 {
68 client_id: "http://127.0.0.1:3000/oauth-client-metadata.json",
69 client_name: "grain",
70 scope: grainScopes,
71 redirect_uris: ["http://127.0.0.1:3000/oauth/callback", "http://127.0.0.1:3000/admin"],
72 },
73 {
74 client_id: "grain-native://app",
75 client_name: "Grain for iOS",
76 scope: grainScopes,
77 redirect_uris: ["grain://oauth/callback"],
78 },
79 ],
80 },
81});