Simple site engine with admin dashboard written in React. It uses PHP as a backend and MySQL as a database engine.
This engine has dependencies:
- SASS/SCSS,
- React,
- react-router,
- react-redux,
- axios,
- babel (to compile JSX).
- ...and webpack (to compile all together).
- Create new mysql database.
- Import default database tables:
- Pages table from
public/inc/db-pages.sql
, - Users table from
public/inc/db-users.sql
.
- Pages table from
- Place your repository in apache
www
directory. - Copy
public/inc/config-default.php
topublic/inc/config.php
and edit it. You need to set database name, host, username and password. Also you may set different session name for php. - Install npm dependencies:
npm install
. - Compile CSS: run script
compile-css.sh
. - Compile dashboard: run script
compile-admin-production.sh
orcompile-admin-watch
.
Now you should be able to navigate your browser to public
directory.
Default index page will appear.
Navigate your browser to public/admin
.
Default username is admin
and password is password
.
public
- this directory should be exposed to www.public/assets
- Additional fonts, images and other files.public/backend
- A set of scripts that providing backend API for the dashboard.public/inc
- A set of server-side engine PHP scripts.public/tpl
- Page templates in PHP.
scss
- Source code for site (not dashboard) SASS/SCSS files.src
- Source code for dashboard.
All of the requests to site going through index.php
. It decides
which page to show and load it to variables for templates. Then, it imports
a template from public/tpl
directory.
There are three types of templates:
admin.php
- for admin page.error404.php
- for 404 page.main.php
- for all other pages (e.g. pages with content).
Also, templates use style sheets from public/css
directory. This styles
should be compiled from /scss
folder as they are written in SASS/SCSS.
Dashboard part is a React application. It locates in src
directory
and compiles to public/js/admin/main_bundle.js
.
It uses SASS/SCSS, React,
redux, react-router
and axios.