You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+88-19Lines changed: 88 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,28 @@
1
1
# precursor
2
2
3
-
## Usage
3
+
## The Pitch
4
4
5
-
Fetch the Om source, which is installed as a submodule (in yaks/om):
5
+
[Precursor](https://precursorapp.com) is the best way to collaborate on early prototypes with your team. Start every project with a new Precursor doc, share the link with your team, hit the speaker in the lower right to share your audio, and start sketching out your ideas. It's better than Sketch, Skype, and Slack put together.
6
+
7
+
Check the [How to](https://precursorapp.com/document/How-to-17592197661008) doc to learn about some of Precursor's features.
8
+
9
+
## This is the code that runs Precursor
10
+
11
+
The Precursor founders, [Danny](https://twitter.com/dannykingme) and [Daniel](https://twitter.com/danielwoelfel), have generously released made the Precursor code open to the public. Precursor is an excellent resource if you're interested in Clojure, ClojureScript, Datomic, advanced CSS, or just how to put together a modern web app.
12
+
13
+
## Setting up your own instance
14
+
15
+
If you're a company that wants to run Precursor on your own hardware, please contact [Daniel](mailto:[email protected]) for help getting set up. We've made some effort to allow anyone to spin up their own Precursor instance, but there are still some roadblocks to work around.
16
+
17
+
## Contributing
18
+
19
+
We're still working out requirements for this. There will likely be a contributor's agreement. Please follow [@precursorapp](https://twitter.com/precursorapp) for updates.
20
+
21
+
## Development Requirements
22
+
23
+
### Frontend
24
+
25
+
Fetch our fork of Om, which is installed as a submodule (in yaks/om):
6
26
7
27
```
8
28
git submodule update --init
@@ -14,43 +34,92 @@ Install node dependencies (requires a recent version of node):
14
34
npm install
15
35
```
16
36
17
-
Download datomic from here https://my.datomic.com/downloads/free
Download Datomic Pro Starter Edition [https://my.datomic.com/starter](https://my.datomic.com/starter). You'll have to create a new account with Datomic to get a license key.
47
+
48
+
Unzip it Datomic and add your license key to `config/samples/dev-transactor-template.properties`
That will start a server on port 8080 and start an nrepl on port 6005.
56
+
### Webserver
32
57
58
+
First, create a secrets file. Unfortunately we can't share the development secrets.
33
59
34
-
Compile the frontend clojurescript assets:
60
+
Copy `pc.profile/ProfileSchema` into a new file, `resources/secrets/my-secrets-file.edn`.
61
+
62
+
Replace the values, filling in the fields with proper values. This part is not well-tested. You can try putting dummy values for most things. Please open issues on GitHub if you run into problems. PRs to simplify this process are very welcome.
63
+
64
+
Then encrypt the file using gpg with a symmetrical passphrase:
Then go to [http://localhost:8080](http://localhost:8080)
70
+
Enter your passphrase at the prompt (I've used "hello" as an example).
42
71
43
-
### Browser REPL
44
-
45
-
nrepl in to the nrepl server and run:
72
+
Start the webserver:
46
73
47
74
```
48
-
(pc.utils/connect-browser-weasel)
75
+
GPG_PASSPHRASE='hello' PROFILE_SOURCE='secrets/my-secrets-file.edn.gpg' lein run
49
76
```
50
77
51
-
Then reload the app.
78
+
Now you should have a server running on port 8080 and start an nrepl server on port 6005.
79
+
80
+
Go to [http://localhost:8080](http://localhost:8080). If you see the app, everything worked. If not, check the output of `lein run` for errors.
81
+
82
+
## Project layout
83
+
84
+
### Backend
85
+
86
+
`src/pc/init.clj` is the entry point that sets up all of the server's state
87
+
88
+
`src/pc/views/` contains HTML generated by the backend. This is where the blog, admin pages, and the bootstrap HTML for the frontend live.
89
+
90
+
`src/pc/models/` contains the very light layer for fetching, creating, and updating Precursor's data abstractions. We decided to stay as close to the Datomic representation as possible, and this has worked very well for us. In general, Precursor's philosophy is to use abstractions sparingly because [abstractions are hard](https://www.amazon.com/gp/product/B00DD6YDFG). Bad abstractions are usually much worse than too few abstractions.
91
+
92
+
`src/pc/http/` contains the code that handles web requests lives here, except for the code that actually sets up the http server, which lives at `src/pc/server.clj`.
93
+
94
+
`src/pc/http/sente.clj` is a poorly-named file (Precursor switched from Sente to [Talaria](https://github.com/dwwoelfel/talaria)) that handles realtime messages to the browser over websockets. Ideally, it would be split into multiple smaller files. You can see a better approach in `src/pc/http/issues.clj`.
95
+
96
+
There is more, but those are the main pieces.
97
+
98
+
### Frontend
99
+
100
+
The frontend is very similar to [CircleCI's open-source frontend](https://github.com/circleci/frontend). I'd recommend watching Brandon Bloom's Clojure/West talk [Building CircleCI's Frontend with Om](https://www.youtube.com/watch?v=LNtQPSUi1iQ), for a quick overview.
101
+
102
+
`src-cljs/frontend/core.cljs` is the entry point.
103
+
104
+
`src-cljs/frontend/components/` contains all of the view code.
105
+
106
+
`src-cljs/frontend/controllers/` contains all of the code that changes state.
107
+
108
+
There is more, but those are the main pieces.
109
+
110
+
### Notable libraries/software
111
+
112
+
Database is Datomic, we've been very happy with it in conjunction with [Datascript](https://github.com/tonsky/datascript). I can't imagine building Precursor's realtime features without it. Some of the more advanced features we had planned, like forking and infinite undo would be much harder without it.
113
+
114
+
HTTP server is Immutant. We have found it very stable. We switched from http-kit, which was also pretty good, but doesn't support features needed to implement back pressure.
115
+
116
+
We manage http connections with [Talaria](https://github.com/dwwoelfel/talaria).
117
+
118
+
We use [Figwheel](https://github.com/bhauman/lein-figwheel) to speed up development on the frontend.
119
+
120
+
[Gumshoe](https://github.com/datodev/gumshoe) helps us to iterate faster on the backend.
0 commit comments