MCPcopy Index your code
hub / github.com/djyde/serlina

github.com/djyde/serlina @2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.0 ↗ · + Follow
59 symbols 141 edges 47 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

logo npm downloads CircleCI

A progressive React serverside-rendering framework.

Motivation

I love using Next.js, but most of my projects need to use our own web server framework while Next.js run it own server. So I begin making a SSR framework (core) that like Next.js but open for server implementation. It does all the building, compiling, rendering-to-string things and give the rest render-to-html things to your own web server.

Of course I know Next.js can custom server and routing, but while Next.js handle the whole http context, I cannot use it in a high layer web framework.

Read the announcing post

Integrations

Quick Start

npm i serlina react react-dom --save

Create a folder structure like:

├── index.js
├── pages
│   └── page1.js
// pages/page1.js

export default () => {
  return 

Hello Serlina!


}

And implement a most simple http server:

// index.js

const { Serlina } = require('serlina')
const path = require('path')

const http = require('http')

const serlina = new Serlina({
  baseDir: path.resolve(__dirname, './')
})

serlina.prepare()
  .then(() => {
    http.createServer(async (req, res) => {
        res.writeHead(200, { 'Content-Type': 'text/html' })
        if (req.url === '/page1') {
          const rendered = await serlina.render('page1')
          res.write(rendered.body)
        } else {
          res.write('works!')
        }
        res.end()
    }).listen(8090)
  })
  .catch(console.error)

Open http://localhost:8090/page1, you will see the page you wrote in React!

Documentation

Visit Full Doc

Development

npm run bootstrap

npm test # run test

License

MIT License

Extension points exported contracts — how you extend this code

SerlinaOptions (Interface)
(no doc)
packages/serlina/lib/serlina.ts
SerlinaInstanceOptions (Interface)
(no doc)
packages/serlina/lib/serlina.ts
DocumentProps (Interface)
(no doc)
packages/serlina/lib/components/Document.tsx
MakeWebpackConfigOptions (Interface)
(no doc)
packages/serlina/lib/config/webpack.config.ts

Core symbols most depended-on inside this repo

render
called by 12
packages/serlina/test/unit/fixtures/sample/pages/page2.js
prepare
called by 8
packages/serlina/lib/serlina.ts
inject
called by 3
packages/serlina/lib/serlina.ts
noCacheRequire
called by 2
packages/serlina/lib/serlina.ts
build
called by 2
packages/serlina/lib/serlina.ts
on
called by 2
packages/serlina/lib/utils/eventbus.ts
client
called by 2
examples/apollo/pages/home.js
render
called by 1
packages/serlina-react-router/src/withRouter.tsx

Shape

Class 24
Method 23
Function 8
Interface 4

Languages

TypeScript100%

Modules by API surface

packages/serlina/lib/serlina.ts12 symbols
packages/serlina/test/unit/fixtures/sample/pages/page2.js4 symbols
packages/serlina/lib/utils/eventbus.ts4 symbols
packages/serlina-react-router/src/withRouter.tsx4 symbols
packages/serlina-apollo/src/withApollo.tsx4 symbols
examples/sample/pages/page2.js4 symbols
examples/react-router/pages/home.js4 symbols
packages/serlina-serve/index.js3 symbols
examples/sample/pages/foo.tsx3 symbols
examples/sample/pages/counter.js3 symbols
examples/react-router/views/Home/index.js3 symbols
examples/react-router/views/Home/about.js3 symbols

For agents

$ claude mcp add serlina \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page