Skip to content

Commit 444890d

Browse files
committed
updated README to be a little more sane, added storybook
1 parent 3f49bfc commit 444890d

File tree

1 file changed

+100
-31
lines changed

1 file changed

+100
-31
lines changed

README.md

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@
22
# Condenser
33

44

5-
Condenser is the react.js web interface to the world's first and best blockchain-based social media platform, steemit.com. It uses [STEEM](https://github.com/steemit/steem), a blockchain powered by Graphene 2.0 technology to store JSON-based content for a plethora of web applications.
5+
Condenser is the react.js web interface to the world's first and best
6+
blockchain-based social media platform, steemit.com. It uses
7+
[STEEM](https://github.com/steemit/steem), a blockchain powered by Graphene
8+
2.0 technology to store JSON-based content for a plethora of web
9+
applications.
610

711
## Why would I want to use Condenser (steemit.com front-end)?
8-
* Learning how to build blockchain-based web applications using STEEM as a content storage mechanism in react.js
12+
13+
* Learning how to build blockchain-based web applications using STEEM as a
14+
content storage mechanism in react.js
915
* Reviewing the inner workings of the steemit.com social media platform
1016
* Assisting with software development for steemit.com
1117

1218
## Installation
1319

1420
#### Docker
1521

16-
We highly recommend using docker to run condenser. This is how we run the live steemit.com site and it is the most supported (and fastest) method of both building and running condenser. We will always have the latest version of condenser (master branch) available on dockerhub. Configuration settings can be set using environment variables (see configuration section below for more information). If you need to install docker, you can get it at https://get.docker.com
22+
We highly recommend using docker to run condenser. This is how we run the
23+
live steemit.com site and it is the most supported (and fastest) method of
24+
both building and running condenser. We will always have the latest version
25+
of condenser (master branch) available on Docker Hub. Configuration settings
26+
can be set using environment variables (see configuration section below for
27+
more information). If you need to install docker, you can get it at
28+
https://get.docker.com
1729

1830
To bring up a running container it's as simple as this:
1931

@@ -27,7 +39,9 @@ Environment variables can be added like this:
2739
docker run -it --env SDC_DATABASE_URL="mysql://user:pass@hostname/databasename" -p 8080:8080 steemit/condenser
2840
```
2941

30-
If you would like to modify, build, and run condenser using docker, it's as simple as pulling in the github repo and issuing one command to build it, like this:
42+
If you would like to modify, build, and run condenser using docker, it's as
43+
simple as pulling in the github repo and issuing one command to build it,
44+
like this:
3145

3246
```bash
3347
git clone https://github.com/steemit/condenser
@@ -39,6 +53,7 @@ docker run -it -p 8080:8080 myname/condenser:mybranch
3953
## Building from source without docker (the 'traditional' way):
4054

4155
#### Clone the repository and make a tmp folder
56+
4257
```bash
4358
git clone https://github.com/steemit/condenser
4459
cd condenser
@@ -47,16 +62,27 @@ mkdir tmp
4762

4863
#### Install dependencies
4964

50-
Install at least Node v8.7 if you don't already have it. We recommend using `nvm` to do this as it's both the simplest way to install and manage installed version(s) of node. If you need `nvm`, you can get it at [https://github.com/creationix/nvm](https://github.com/creationix/nvm).
65+
Install at least Node v8.7 if you don't already have it. We recommend using
66+
`nvm` to do this as it's both the simplest way to install and manage
67+
installed version(s) of node. If you need `nvm`, you can get it at
68+
[https://github.com/creationix/nvm](https://github.com/creationix/nvm).
5169

52-
Condenser is known to successfully build using node 8.7, npm 5.4.2, and yarn 1.3.2.
70+
Condenser is known to successfully build using node 8.7, npm 5.4.2, and
71+
yarn 1.3.2.
5372

5473
Using nvm, you would install like this:
74+
5575
```bash
5676
nvm install v8.7
5777
```
5878

59-
We use the yarn package manager instead of the default `npm`. There are multiple reasons for this, one being that we have `steem-js` built from source pulling the github repo as part of the build process and yarn supports this. This way the library that handles keys can be loaded by commit hash instead of a version name and cryptographically verified to be exactly what we expect it to be. Yarn can be installed with `npm`, but afterwards you will not need to use `npm` further.
79+
We use the yarn package manager instead of the default `npm`. There are
80+
multiple reasons for this, one being that we have `steem-js` built from
81+
source pulling the github repo as part of the build process and yarn
82+
supports this. This way the library that handles keys can be loaded by
83+
commit hash instead of a version name and cryptographically verified to be
84+
exactly what we expect it to be. Yarn can be installed with `npm`, but
85+
afterwards you will not need to use `npm` further.
6086

6187
```bash
6288
npm install -g yarn
@@ -70,53 +96,84 @@ To run condenser in production mode, run:
7096
yarn run production
7197
```
7298

73-
When launching condenser in production mode it will automatically use 1 process per available core. You will be able to access the front-end at http://localhost:8080 by default.
99+
When launching condenser in production mode it will automatically use 1
100+
process per available core. You will be able to access the front-end at
101+
http://localhost:8080 by default.
74102

75103
To run condenser in development mode, run:
76104

77105
```bash
78106
yarn run start
79107
```
80108

81-
It will take quite a bit longer to start in this mode (~60s) as it needs to build and start the webpack-dev-server.
109+
It will take quite a bit longer to start in this mode (~60s) as it needs to
110+
build and start the webpack-dev-server.
82111

83-
By default you will be connected to steemit.com's public steem node at `wss://steemd.steeemit.com`. This is actually on the real blockchain and you would use your regular account name and credentials to login - there is not an official separate testnet at this time. If you intend to run a full-fledged site relying on your own, we recommend looking into running a copy of `steemd` locally instead [https://github.com/steemit/steem](https://github.com/steemit/steem).
112+
By default you will be connected to steemit.com's public steem node at
113+
`wss://steemd.steeemit.com`. This is actually on the real blockchain and
114+
you would use your regular account name and credentials to login - there is
115+
not an official separate testnet at this time. If you intend to run a
116+
full-fledged site relying on your own, we recommend looking into running a
117+
copy of `steemd` locally instead
118+
[https://github.com/steemit/steem](https://github.com/steemit/steem).
84119

85120
#### Configuration
86121

87-
The intention is to configure condenser using environment variables. You can see the names of all of the available configuration environment variables in `config/custom-environment-variables.json`. Default values are stored in `config/defaults.json`.
122+
The intention is to configure condenser using environment variables. You
123+
can see the names of all of the available configuration environment
124+
variables in `config/custom-environment-variables.json`. Default values are
125+
stored in `config/defaults.json`.
88126

89127
Environment variables using an example like this:
90128

91129
```bash
92130
export SDC_CLIENT_STEEMD_URL="wss://steemd.steemit.com"
93131
export SDC_SERVER_STEEMD_URL="wss://steemd.steemit.com"
94132
```
95-
Keep in mind environment variables only exist in your active session, so if you wish to save them for later use you can put them all in a file and `source` them in.
96133

97-
If you'd like to statically configure condenser without variables you can edit the settings directly in `config/production.json`. If you're running in development mode, copy `config/production.json` to `config/dev.json` with `cp config/production.json config/dev.json` and adjust settings in `dev.json`.
134+
Keep in mind environment variables only exist in your active session, so if
135+
you wish to save them for later use you can put them all in a file and
136+
`source` them in.
137+
138+
If you'd like to statically configure condenser without variables you can
139+
edit the settings directly in `config/production.json`. If you're running
140+
in development mode, copy `config/production.json` to `config/dev.json`
141+
with `cp config/production.json config/dev.json` and adjust settings in
142+
`dev.json`.
98143

99-
If you're intending to run condenser in a production environment one configuration option that you will definitely want to edit is `server_session_secret` which can be set by the environment variable `SDC_SESSION_SECRETKEY`. To generate a new value for this setting, you can do this:
144+
If you're intending to run condenser in a production environment one
145+
configuration option that you will definitely want to edit is
146+
`server_session_secret` which can be set by the environment variable
147+
`SDC_SESSION_SECRETKEY`. To generate a new value for this setting, you can
148+
do this:
100149

101150
```bash
102151
node
103152
> crypto.randomBytes(32).toString('base64')
104153
> .exit
105154
```
106155

107-
#### Install mysql server
156+
## Install mysql server
108157

109-
If you've followed the instructions up until this point you will already have a running condenser installation which is entirely acceptable for development purposes. It is *not required to run a SQL server for development*. If you're running a full-fledged site however, you will want to set one up.
158+
If you've followed the instructions up until this point you will already
159+
have a running condenser installation which is entirely acceptable for
160+
development purposes. It is *not required to run a SQL server for
161+
development*. If you're running a full-fledged site however, you will want
162+
to set one up.
110163

111-
Once set up, you can set the mysql server configuration option for condenser using the environment variable `SDC_DATABASE_URL`, or alternatively by editing it in `config/production.json`. You will use the format `mysql://user:pass@hostname/databasename`.
164+
Once set up, you can set the mysql server configuration option for
165+
condenser using the environment variable `SDC_DATABASE_URL`, or
166+
alternatively by editing it in `config/production.json`. You will use the
167+
format `mysql://user:pass@hostname/databasename`.
112168

113169
Example:
114170

115171
```bash
116172
export SDC_DATABASE_URL="mysql://root:[email protected]/steemit_dev"
117173
```
118174

119-
Here are instructions for setting up a mysql server and running the necessary migrations by operating system:
175+
Here are instructions for setting up a mysql server and running the
176+
necessary migrations by operating system:
120177

121178
OS X:
122179

@@ -135,8 +192,8 @@ sudo apt-get update
135192
sudo apt-get install mysql-server
136193
```
137194

138-
On Ubuntu 16.04+ you may be unable to connect to mysql without root access, if
139-
so update the mysql root user as follows:
195+
On Ubuntu 16.04+ you may be unable to connect to mysql without root access,
196+
if so update the mysql root user as follows:
140197

141198
```
142199
sudo mysql -u root
@@ -153,12 +210,14 @@ mysql -u root
153210
> quit
154211
```
155212

156-
#### Database migrations
213+
### Database migrations
157214

158-
This is a required step in order for the database to be 'ready' for condenser's use.
215+
This is a required step in order for the database to be 'ready' for
216+
condenser's use.
159217

160-
161-
Edit the file `src/db/config/config.json` using your favorite command line text editor being sure that the username, password, host, and database name are set correctly and match your newly configured mysql setup.
218+
Edit the file `src/db/config/config.json` using your favorite command line
219+
text editor being sure that the username, password, host, and database name
220+
are set correctly and match your newly configured mysql setup.
162221

163222
Run `sequelize db:migrate` in `src/db` directory, like this:
164223

@@ -167,22 +226,28 @@ cd src/db
167226
yarn exec sequelize db:migrate
168227
```
169228

170-
#### Style Guides For Submitting Pull Requests
229+
## Style Guides For Submitting Pull Requests
171230

172-
##### File naming and location
231+
### File naming and location
173232

174233
- Prefer CamelCase js and jsx file names
175234
- Prefer lower case one word directory names
176235
- Keep stylesheet files close to components
177236
- Component's stylesheet file name should match component name
178237

179-
##### Js & Jsx
238+
#### Js & Jsx
239+
240+
We use [prettier](https://github.com/prettier/prettier) to autofromat the
241+
code, with [this configuration](.prettierrc). Run `yarn run fmt` to format
242+
everything in `src/`, or `yarn exec -- prettier --config .prettierrc
243+
--write src/whatever/file.js` for a specific file.
180244

181-
We use [prettier](https://github.com/prettier/prettier) to autofromat the code, with [this configuration](.prettierrc). Run `yarn run fmt` to format everything in `src/`, or `yarn exec -- prettier --config .prettierrc --write src/whatever/file.js` for a specific file.
245+
#### CSS & SCSS
182246

183-
##### CSS & SCSS
184-
If a component requires a css rule, please use its uppercase name for the class, e.g. "Header" class for the header's root div.
185-
We adhere to BEM methodology with exception for Foundation classes, here is an example for the Header component:
247+
If a component requires a css rule, please use its uppercase name for the
248+
class, e.g. "Header" class for the header's root div. We adhere to BEM
249+
methodology with exception for Foundation classes, here is an example for
250+
the Header component:
186251

187252
```html
188253
<!-- Block -->
@@ -195,6 +260,10 @@ We adhere to BEM methodology with exception for Foundation classes, here is an e
195260
</ul>
196261
```
197262

263+
## Storybook
264+
265+
`yarn run storybook`
266+
198267
## Testing
199268

200269
### Run test suite

0 commit comments

Comments
 (0)