- v17.6Latest
- v17.5
- v17.4
- v17.3
- v17.2
- v17.1
- v17.0
- v16.9
- v16.8
- v16.7
- v16.6
- v16.5
- v16.4
- v16.3
- v16.2
- v16.1
- v16.0
- v15.8
- v15.7
- v15.6
- v15.5
- v15.4
- v15.3
- v15.2
- v15.1
- v15.0
- v14.9
- v14.8
- v14.7
- v14.6
- v14.5
- v14.4
- v14.3
- 14.2
- v14.1
- v14.0
- v13.9
- v13.8
- v13.7
- v13.6
- v13.5
- v13.4
- v13.3
- v13.2
- v13.1
- v13.0
- v12.9
- v12.8
- v12.7
- v12.6
- v12.5
- v12.4
- v12.3
- v12.2
- v12.1
- v12.0
- v11.9
- v11.8
- v11.7
- v11.6
- v11.5
- v11.4
- v11.3
- v11.2
- v11.1
- v11.0
- v10.9
- v10.8
- v10.7
- v10.6
- v10.5
- v10.4
- v10.3
- v10.2
- v10.1
- v10.0
- v9.9
- v9.8
- v9.7
- v9.6
- v9.5
- 9.4
- v9.3
- v9.2
- v9.1
- v9.0
- v8.9
- v8.8
- v8.7
- v8.6
- v8.5
- v8.4
- v8.3
- v8.2
- v8.1
- v8.0
- v7.9
- v7.8
- v7.7
- v7.6
- v7.5
- v7.4
- v7.3
- v7.2
- v7.1
- v7.0
- v6.9
- v6.8
- v6.7
- v6.6
- v6.5
- v6.4
- v6.3
- v6.2
- v6.1
- v6.0
- v5.9
- v5.8
- v5.7
- v5.6
- v5.5
- v5.4
- v5.3
- v5.2
- v5.1
- v5.0
- v4.9
- v4.8
- v4.7
- v4.6
- v4.5
- v4.4
- v4.3
- v4.2
- v4.1
- v4.0
- v3.9
- v3.8
- v3.7
- v3.6
- v3.5
- v3.4
- v3.3
- v3.2
- v3.1
- v3.0
- v2.9
- v2.8
- v2.7
- v2.6
- v2.5
- v2.4
- v2.3
- v2.2
- v2.1
- v2.0
- v1.9
- v1.8
- v1.7
- v1.6
- v1.5
- v1.4
- v1.3
- v1.2
- v1.1
- v1.0
faster_react
It is a complete framework, with automatic compilation of components for the
client side, Server Side Rendering, Hydration and interactive client-side
components. It has folders in its structure for automatic inclusion of pages,
routes, components and static files. It has automatic reload client side and
compilation when "dev":true
in options.json
. There is also automatic
generation of routes based on the file and folder structure. It focuses on
performance and practicality. 100% Deno, no Node dependencies. About Faster, it
is an optimized server middleware. See more at: https://github.com/hviana/faster
Contents
Framework structure
All these application folders are inside the app
folder. Remember that any
change in these folders will cause the framework to compile, cache, and deliver
everything automatically to the client, also updating server-side resources.
There is no need to restart the application.
frontend_pages folder
- Use only frontend libraries here.
- You can organize your files into subdirectories here.
- The
.tsx
extension is used here. - These pages are rendered on the server and hydrated on the client.
- Routes to these pages are generated automatically. For example, the path
localhost:8080/pages/checkout/cart
refers to the fileapp/frontend_pages/checkout/cart.tsx
. It is important to note that the initial route will point toapp/frontend_pages/index.tsx
(ex:localhost:8080
=>app/frontend_pages/index.tsx
). - This file must have a default export with the React Function/Component.
- The properties passed to the page includes:
- Form-submitted data (or JSON POST);
- URL search parameters, such as
/pages/myPage?a=1&b=2
will result in{a:1, b:2}
; options.json => framework
;backend_pages_props
manipulations;- Request headers within the
headers
key.
frontend_components folder
- Use only frontend libraries here.
- You can organize your files into subdirectories here.
- The
.tsx
extension is used here. - This file must have a default export with the React Function/Component.
frontend_scripts folder
- Use only frontend libraries here.
- You can organize your files into subdirectories here.
- Here the extension
.ts
and.js
is used. - You are free to make as many exports or calls (including asynchronous) as you
want here. Different from
frontend_pages
frontend_components
, the scripts here are not automatically delivered to the client. They need to be imported by thefrontend_components
orfrontend_pages
. The intention here is to group common functions/objects for React Functions/Components, such as form field validations. You can also havefrontend_scripts
in common for otherfrontend_scripts
.
css folder
Application css style files.
- You can have multiple CSS files and they are automatically compiled.
- You can organize your files into subdirectories here.
static folder
Files that will be served statically. Routes are generated automatically based
on the folder and file structure, for example
localhost:8080/static/favicon.ico
will match the file
app/static/favicon.ico
.
backend_api folder
- You can import your backend libraries here.
- You can organize your files into subdirectories here.
- The
.ts
extension is used here. - The file and folder structure is free here and does not influence anything.
- Here you are also free to define the routes in whatever pattern you want.
- This file must have a default export with the function (which can be asynchronous).
- This function has as input parameter an instance of Server of faster.
- You can do your backend manipulations here. For example, getting data from the database. Including asynchronous calls.
- Define your custom api routes. For help, see: https://github.com/hviana/faster
backend_pages_props folder
- You can import your backend libraries here.
- You can organize your files into subdirectories here.
- The
.ts
extension is used here. - Each of these files must have the same folder structure and name as the
corresponding page, with the difference in the extension, which here is .ts.
For example
app/frontend_pages/checkout/cart.tsx
should have as a corresponding (if one exists)app/backend_pages_props/checkout/cart.ts
here. - This file must have a default export with the function (which can be asynchronous) that will handle the props that will be passed to the page.
- This function has as input parameter the props that will be passed to the page.
- Only use JSON serializable data inside props.
- You can do your backend manipulations here. For example, getting data from the database. Including asynchronous calls.
backend_files folder
- You can import your backend libraries here.
- You can organize your files into subdirectories here.
- The
.ts
extension is used here. - You are free to make as many exports or calls (including asynchronous) as you want here.
- The intention here is to group common functions/objects for
backend_api
,backend_pages_props
(andbackend_files
, since you may havebackend_files
in common for otherbackend_files
) files, such as user validations.- These libraries can only be imported dynamically in
backend_api
,backend_pages_props
(andbackend_files
), following the format (as an example, thegeneral.ts
file):So, you can use:const general = await import( `../backend_files/general.ts#${Date.now()}` );
Or, if you have a default export:general.myFuncExample(params); await general.myFuncExample(params); new general.MyClassExample(params); //etc.
So, you can use:const general = (await import( `../backend_files/general.ts#${Date.now()}` )).default;
general(params); await general(params); new general(params); //etc.
- These libraries can only be imported dynamically in
Packages included
There are several packages included to help you develop React applications. Here
are some examples of imports
that you can use without configuring anything:
import {/* your imports */} from "react";
import {/* your imports */} from "react/";
import {/* your imports */} from "react-dom";
import {/* your imports */} from "react-dom/server";
import {/* your imports */} from "react-dom/client";
import {/* your imports */} from "react-router-dom";
import {/* your imports */} from "react-router";
import {/* your imports */} from "react/jsx-runtime";
import {/* your imports */} from "render";
import {/* your imports */} from "htm/react";
import {/* your imports */} from "faster";
Creating a project
It is necessary to execute the command:
deno run -A -r "https://deno.land/x/faster_react/new.ts" myProjectFolder
. It
is important to highlight that you need the git command installed and
configured. You can make your customizations and configure the server in
options.json
.
Running a project
It is necessary to execute the command: deno task serve
About
Author: Henrique Emanoel Viana, a Brazilian computer scientist, enthusiast of web technologies, cel: +55 (41) 99999-4664. URL: https://sites.google.com/view/henriqueviana
Improvements and suggestions are welcome!