2021-07-23 18:25:54 +03:00
# CodeX Docs
2022-04-12 11:29:25 +04:00
CodeX Docs is a simple but powerful documentation engine for CodeX powered with [Editor.js ](//editorjs.io ).
You can use CodeX Docs for product documentation, for internal team docs, or for any other documentation.
2021-07-23 18:25:54 +03:00

## Development
2022-04-12 11:29:25 +04:00
### Prerequisites
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
- NodeJS (v16.x)
- npx (installed by default with npm)
- Yarn
2021-07-23 18:25:54 +03:00
2022-04-12 11:29:25 +04:00
### Install npm packages
```shell
yarn install --frozen-lockfile
2018-09-03 23:05:50 +03:00
```
2022-04-12 11:29:25 +04:00
### Create config file
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
```shell
cp .codexdocsrc.sample .codexdocsrc
2022-04-24 16:54:36 +05:30
cp .env.sample .env
2018-09-03 23:05:50 +03:00
```
2022-04-12 11:29:25 +04:00
### Run application (both frontend and backend)
```shell
yarn dev
2018-09-03 23:05:50 +03:00
```
2022-04-12 11:29:25 +04:00
Then you can open browser and navigate to [http://localhost:3000 ](http://localhost:3000 ).
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
Now you can [authenticate ](https://github.com/codex-team/codex.docs/#authentication ) in the application and start creating your documentation.
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
### Available scripts
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
#### Start whole application (backend and frontend in watch mode)
```shell
yarn dev
2018-09-03 23:05:50 +03:00
```
2022-04-12 11:29:25 +04:00
#### Start backend in development mode
```shell
yarn start-backend
2022-03-05 22:57:23 +04:00
```
2022-04-12 11:29:25 +04:00
#### Compile TypeScript files
```shell
yarn compile
2022-03-05 22:57:23 +04:00
```
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
#### Build frontend
To build frontend sources run the following command:
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
```shell
yarn build-frontend
2018-09-03 23:05:50 +03:00
```
2022-04-12 11:29:25 +04:00
To build frontend and watch for changes run the following command:
```shell
yarn build-frontend:dev
2018-09-03 23:05:50 +03:00
```
2021-07-23 18:25:54 +03:00
#### Run ESLint with `--fix` option
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
```shell
yarn lint
2018-09-03 23:05:50 +03:00
```
2021-07-23 18:25:54 +03:00
#### Run tests
2018-09-03 23:05:50 +03:00
2022-04-12 11:29:25 +04:00
```shell
yarn test
2018-09-03 23:05:50 +03:00
```
Authentication (#22)
* Authorization added
* added secret to password, md5 hashing, removed promise from verifyToken, deleted links when not authorized
* added dbinsert script
* turned verifyToken to middleware, added description for dbinsert, added hidden csrf field in auth form
* added middlewares, user model and controller
* JSDoc fix
* wrong password processing fix
* added comments to dbinsert script, moved salt and passHash to singe db doc
* Moved salt to .env, upgradedscript for generating password was, fixed comments and JSDoc
* Deleted using salt (now user is only one), changed verifying password to bcrypt.compare, added httpyOnly property to jwt cookie
2019-03-06 13:22:57 +03:00
Added ability to use custom favicon (#202)
* Added ability to change favicon in config
* Turned back version of icon in index.twig
* Added opportunity to upload favicon and route to get saved favicon
* Removed favicon from .codexdocsrc.sample
* Added docs to favicon route
* Replaced uploadFavicon to initiating /favicon route, updated function, added catching errors from uploadFile
* Updated Readme, added info about setting up app
* Updated Readme.md
* Some changes
* Favicon data saves to app.locals, replaced uploading favicon to app.ts
* Changed naming in config, from faviconURL to favicon, changed using app.locals variables
* Renamed uploadFavicon to downLoadFavicon, removed log in locals.ts
* Renamed favicon variable in app.ts
* Added checking favicon before uploading function, removed passing locals to views
* Added timeout for uploading favicon request and writeFileSync changed to writeFile
* Removed passing favicon locals and turned back removed variables
* Turned back variables
* Fixed duplicating os.tmpdir
* Fixed braces in objects, added new lines
* Added default favicon path, if favicon does not exists in config
* Updated docs, fixed using local favicon
2022-07-10 15:21:32 +03:00
### Setup
You can configure application using configs in < code > /config< / code > directory.
| Property | Role |
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| < code > port< / code > | to set port of application |
| < code > database< / code > | to name directory with data |
| < code > rcFile< / code > | to set destination of codexdocsrc config file |
| < code > uploads< / code > | to set destination of directory to save uploads |
| < code > secret< / code > | to set secret |
| < code > favicon</ code > | to set url or favicon path (favicon need to be in /public directory), like `/myFavicon.png` , to get favicon. Server uploads file by url and saves it to temporary directory. And you can get favicon by /favicon static route of application |
You can configure application using configs in < code > /config< / code > directory.
Authentication (#22)
* Authorization added
* added secret to password, md5 hashing, removed promise from verifyToken, deleted links when not authorized
* added dbinsert script
* turned verifyToken to middleware, added description for dbinsert, added hidden csrf field in auth form
* added middlewares, user model and controller
* JSDoc fix
* wrong password processing fix
* added comments to dbinsert script, moved salt and passHash to singe db doc
* Moved salt to .env, upgradedscript for generating password was, fixed comments and JSDoc
* Deleted using salt (now user is only one), changed verifying password to bcrypt.compare, added httpyOnly property to jwt cookie
2019-03-06 13:22:57 +03:00
### Authentication
To manage pages you need to authorize (available on `/auth` ).
2022-04-24 16:54:36 +05:30
To set password, set the `PASSWORD` environment variable inside the `.env` file.
2021-07-23 18:25:54 +03:00
2022-04-05 14:03:13 +04:00
## Release process
We use [release-drafter ](https://github.com/release-drafter/release-drafter ) to generate release notes and GitHub release.
It will automatically generate draft release based pull requests data between current version and previous version.
To make new release you need go to [releases ](https://github.com/codex-team/codex.docs/releases ) page find the latest draft release and mark it as ready.
After creating new release, new git tag will be created and new version will be published.
2021-07-23 18:25:54 +03:00
# About CodeX
< img align = "right" width = "120" height = "120" src = "https://codex.so/public/app/img/codex-logo.svg" hspace = "50" >
CodeX is a team of digital specialists around the world interested in building high-quality open source products on a global market. We are [open ](https://codex.so/join ) for young people who want to constantly improve their skills and grow professionally with experiments in cutting-edge technologies.
2022-04-24 16:54:36 +05:30
| 🌐 | Join 👋 | Twitter | Instagram |
| ---------------------------- | -------------------------------------- | -------------------------------------------- | ---------------------------------------------- |
| [codex.so ](https://codex.so ) | [codex.so/join ](https://codex.so/join ) | [@codex_team ](http://twitter.com/codex_team ) | [@codex_team ](http://instagram.com/codex_team ) |